From eb46f0f4219b46fa1d307f84bd0c9705a64ca441 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 5 Aug 2024 22:15:06 +0000 Subject: [PATCH] Fix crash on malformed files Co-authored-by: Mirco Miranda --- src/imageformats/pcx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imageformats/pcx.cpp b/src/imageformats/pcx.cpp index be12c8f..6d47cf9 100644 --- a/src/imageformats/pcx.cpp +++ b/src/imageformats/pcx.cpp @@ -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; }