From 8588c053b632abacf2cbbd6cea0ec0d34c99df52 Mon Sep 17 00:00:00 2001 From: Mirco Miranda Date: Tue, 27 Aug 2024 21:52:16 +0000 Subject: [PATCH] XCF: fix crash --- src/imageformats/xcf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index 97b3ab1..3d67eca 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -1974,6 +1974,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;