From a8f92e55253cd333ee10e6692262d05f064669e2 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 12 Aug 2021 16:43:26 +0200 Subject: [PATCH] PCXHandler::write: Properly fail if the image is too big --- src/imageformats/pcx.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/imageformats/pcx.cpp b/src/imageformats/pcx.cpp index b96ea93..a185e39 100644 --- a/src/imageformats/pcx.cpp +++ b/src/imageformats/pcx.cpp @@ -618,8 +618,12 @@ bool PCXHandler::write(const QImage &image) QImage img = image; - int w = img.width(); - int h = img.height(); + const int w = img.width(); + const int h = img.height(); + + if (w > 65536 || h > 65536) { + return false; + } // qDebug() << "Width: " << w; // qDebug() << "Height: " << h;