From 23f9cec65a76e6aa0675ca426f9e4f6717790dbb Mon Sep 17 00:00:00 2001 From: Niklas Kurkisuo Date: Fri, 18 Feb 2011 09:30:46 +0100 Subject: QImage crash when invalid XPM is read. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add sanity check for cpp, which would otherwise lead to a segfault later in the code. Task-number: QTBUG-17254 Merge-request: 1080 Reviewed-by: Samuel Rødal --- src/gui/image/qxpmhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index a02b3ff..76cd813 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -882,7 +882,7 @@ static bool read_xpm_body( QByteArray buf(200, 0); int i; - if (cpp > 15) + if (cpp < 0 || cpp > 15) return false; // For > 256 colors, we delay creation of the image until -- cgit v0.12