From c2d2a9be66427fe9fb8066894b3422533bb13c25 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 31 Jan 2019 00:56:25 +0100 Subject: [PATCH] pcx: Fix crash on fuzzed file oss-fuzz/12784 --- src/imageformats/pcx.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/imageformats/pcx.cpp b/src/imageformats/pcx.cpp index 7c1a646..a617477 100644 --- a/src/imageformats/pcx.cpp +++ b/src/imageformats/pcx.cpp @@ -253,6 +253,9 @@ static void readImage1(QImage &img, QDataStream &s, const PCXHEADER &header) img = QImage(header.width(), header.height(), QImage::Format_Mono); img.setColorCount(2); + if (img.isNull()) + return; + for (int y = 0; y < header.height(); ++y) { if (s.atEnd()) { img = QImage();