mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-09-24 07:32:02 -04:00
Added limit to maximum number of channels
This commit is contained in:
committed by
Mirco Miranda
parent
8bfdef2e48
commit
52045ff84d
@@ -300,21 +300,17 @@ bool SGIImagePrivate::readImage(QImage &img)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_zsize > KIF_MAX_IMAGE_CHANNELS) {
|
||||
qCDebug(LOG_RGBPLUGIN) << "Too many channels: the plugin is limited to" << KIF_MAX_IMAGE_CHANNELS << "channels";
|
||||
return false;
|
||||
}
|
||||
|
||||
img = imageAlloc(size(), format());
|
||||
if (img.isNull()) {
|
||||
qCWarning(LOG_RGBPLUGIN) << "Failed to allocate image, invalid dimensions?" << QSize(_xsize, _ysize);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_zsize > 4) {
|
||||
// qCDebug(LOG_RGBPLUGIN) << "using first 4 of " << _zsize << " channels";
|
||||
// Only let this continue if it won't cause a int overflow later
|
||||
// this is most likely a broken file anyway
|
||||
if (_ysize > std::numeric_limits<int>::max() / _zsize) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_numrows = _ysize * _zsize;
|
||||
|
||||
if (_rle) {
|
||||
|
||||
Reference in New Issue
Block a user