From eae41980b22915328bac1fa4193c6aaaa01f0ead Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 7 Sep 2025 00:38:05 +0200 Subject: [PATCH] dds: Fix assert when reading broken data oss-fuzz testcase 6027629841154048 --- src/imageformats/dds.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/imageformats/dds.cpp b/src/imageformats/dds.cpp index acedbd0..617514c 100644 --- a/src/imageformats/dds.cpp +++ b/src/imageformats/dds.cpp @@ -1126,7 +1126,11 @@ static QImage readR32F(QDataStream &s, const quint32 width, const quint32 height for (quint32 y = 0; y < height; y++) { float *line = reinterpret_cast(image.scanLine(y)); for (quint32 x = 0; x < width; x++) { - line[x * 4] = readFloat32(s); + const float f = readFloat32(s); + if (std::isnan(f)) { + return {}; + } + line[x * 4] = f; line[x * 4 + 1] = 0; line[x * 4 + 2] = 0; line[x * 4 + 3] = 1;