From 51921e8ee574cbf93fe655aee203e01e6e1532ef Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 29 Jul 2024 20:53:13 +0200 Subject: [PATCH] xcf: Fix crash on malformed files --- src/imageformats/xcf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index 6611d9a..97b3ab1 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -1672,7 +1672,7 @@ bool XCFImageFormat::assignImageBytes(Layer &layer, uint i, uint j, const GimpPr for (int y = 0; y < height; y++) { uchar *dataPtr = bits + y * bytesPerLine; uchar *alphaPtr = nullptr; - if (!layer.alpha_tiles.isEmpty()) { + if (layer.alpha_tiles.size() > j && layer.alpha_tiles.at(j).size() > i) { QImage &alphaTile = layer.alpha_tiles[j][i]; if (alphaTile.width() >= width && alphaTile.height() > y) { alphaPtr = alphaTile.scanLine(y);