Sanity checks (fuzzer)

I ran a stupid fuzzer on all the plugins in the repo and some plugins needs more sanity checks.

- RAS: fixed palette reading on corrupted files
- RGB: improved error detection on datastream

This patch improves the reading speed of some corrupted files and limit the maximum memory allocation of RAS palette.
This commit is contained in:
Mirco Miranda
2024-06-11 22:15:27 +00:00
committed by Albert Astals Cid
parent bd083ff354
commit 863c424390
2 changed files with 12 additions and 4 deletions

View File

@ -360,11 +360,15 @@ bool SGIImage::readImage(QImage &img)
}
_lengthtab = new quint32[_numrows];
for (l = 0; l < _numrows; l++) {
for (l = 0; !_stream.atEnd() && l < _numrows; l++) {
_stream >> _lengthtab[l];
}
}
if (_stream.status() != QDataStream::Ok) {
return false;
}
_data = _dev->readAll();
// sanity check