From b649cca3040feb76bb7116451c2d374068ee00c1 Mon Sep 17 00:00:00 2001 From: Mirco Miranda Date: Thu, 19 Dec 2024 07:18:37 +0000 Subject: [PATCH] DDS: Fix for OSS Fuzz issue 384974505 --- src/imageformats/dds.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/imageformats/dds.cpp b/src/imageformats/dds.cpp index 53f8d8f..eb2b592 100644 --- a/src/imageformats/dds.cpp +++ b/src/imageformats/dds.cpp @@ -597,9 +597,12 @@ static inline int maskLength(quint32 mask) static inline quint32 readValue(QDataStream &s, quint32 size) { - Q_ASSERT(size == 8 || size == 16 || size == 24 || size == 32); - quint32 value = 0; + if (size != 8 && size != 16 && size != 24 && size != 32) { + s.setStatus(QDataStream::ReadCorruptData); + return value; + } + quint8 tmp; for (unsigned bit = 0; bit < size; bit += 8) { s >> tmp;