pcx: fix crash on invalid files

Added new PCX testfile for readtest.
This commit is contained in:
Daniel Novomeský 2024-07-18 20:10:55 +02:00 committed by Albert Astals Cid
parent a497ab789b
commit 638fdfcbdd
3 changed files with 5 additions and 0 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -308,6 +308,11 @@ static bool readImage4(QImage &img, QDataStream &s, const PCXHEADER &header)
return false;
}
if (header.BytesPerLine < (header.width() / 8)) {
qWarning() << "PCX image has invalid BytesPerLine value";
return false;
}
for (int y = 0; y < header.height(); ++y) {
if (s.atEnd()) {
return false;