From e34f53d6ae39f0ffa9e035411180dc389921e669 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 29 Jan 2019 12:32:23 +0100 Subject: [PATCH] ras: Return false if allocating the image failed Probably because it's too huge --- src/imageformats/ras.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/imageformats/ras.cpp b/src/imageformats/ras.cpp index b4d755e..bdba79e 100644 --- a/src/imageformats/ras.cpp +++ b/src/imageformats/ras.cpp @@ -131,6 +131,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img) // Allocate image img = QImage(ras.Width, ras.Height, QImage::Format_ARGB32); + if (img.isNull()) + return false; + // Reconstruct image from RGB palette if we have a palette // TODO: make generic so it works with 24bit or 32bit palettes if (ras.ColorMapType == 1 && ras.Depth == 8) {