From f9f29304d8f08ab255f68ab96c78480dd5c30151 Mon Sep 17 00:00:00 2001 From: Mirco Miranda Date: Tue, 27 Aug 2024 21:52:25 +0000 Subject: [PATCH] XCF: fix crash (KF5) --- src/imageformats/xcf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index cf5092b..8121a9b 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -1976,6 +1976,12 @@ static bool convertFloatTo16Bit(uchar *output, quint64 outputSize, uchar *input) */ bool XCFImageFormat::loadLevel(QDataStream &xcf_io, Layer &layer, qint32 bpp, const GimpPrecision precision) { + auto bpc = bytesPerChannel(precision); + if ((bpc == 0) || (bpp % bpc)) { + qCDebug(XCFPLUGIN) << "XCF: the stream seems corrupted"; + return false; + } + qint32 width; qint32 height;