Fix crash on malformed files

Co-authored-by: Mirco Miranda <mircomir@gmail.com>
This commit is contained in:
Albert Astals Cid 2024-08-05 22:15:06 +00:00
parent 8c23e74ef6
commit eb46f0f421

View File

@ -308,7 +308,7 @@ static bool readImage4(QImage &img, QDataStream &s, const PCXHEADER &header)
return false;
}
if (header.BytesPerLine < (header.width() / 8)) {
if (header.BytesPerLine < (header.width() + 7) / 8) {
qWarning() << "PCX image has invalid BytesPerLine value";
return false;
}