From 7e86e62e8638ae2db619f7ffe751d733ae733a55 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 28 Jan 2019 21:40:42 +0100 Subject: [PATCH] pcx: Fix crash on fuzzed image --- src/imageformats/pcx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/imageformats/pcx.cpp b/src/imageformats/pcx.cpp index a26c813..7c1a646 100644 --- a/src/imageformats/pcx.cpp +++ b/src/imageformats/pcx.cpp @@ -325,6 +325,10 @@ static void readImage8(QImage &img, QDataStream &s, const PCXHEADER &header) readLine(s, buf, header); uchar *p = img.scanLine(y); + + if (!p) + return; + unsigned int bpl = qMin(header.BytesPerLine, (quint16)header.width()); for (unsigned int x = 0; x < bpl; ++x) { p[ x ] = buf[ x ];