RGB: avoid to read wrong data

Should fixes OSS Fuzz issue 42538251
This commit is contained in:
Mirco Miranda 2024-11-11 23:06:49 +00:00 committed by Albert Astals Cid
parent b645c9c258
commit 4923e2ecaa

View File

@ -316,6 +316,9 @@ bool SGIImagePrivate::readImage(QImage &img)
for (l = 0; !_stream.atEnd() && l < _numrows; l++) {
_stream >> _starttab[l];
_starttab[l] -= 512 + _numrows * 2 * sizeof(quint32);
if (_stream.status() != QDataStream::Ok) {
return false;
}
}
for (; l < _numrows; l++) {
_starttab[l] = 0;
@ -324,6 +327,9 @@ bool SGIImagePrivate::readImage(QImage &img)
_lengthtab = new quint32[_numrows];
for (l = 0; !_stream.atEnd() && l < _numrows; l++) {
_stream >> _lengthtab[l];
if (_stream.status() != QDataStream::Ok) {
return false;
}
}
}