From 6881e3111bed100be58e692adf8e26e25f3d2c53 Mon Sep 17 00:00:00 2001 From: Mirco Miranda Date: Tue, 9 Sep 2025 15:59:14 +0200 Subject: [PATCH] HDR: Limits the header to the first 128 lines The HDR header is a set of text information spread across a few lines. According to the specifications I have, the parameters seem to be a total of 7 / 8 but there could be more. This patch limits the header to 128 lines of maximum 1024 bytes. Closes #40 --- src/imageformats/hdr.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/imageformats/hdr.cpp b/src/imageformats/hdr.cpp index 264d1ca..4ee61ac 100644 --- a/src/imageformats/hdr.cpp +++ b/src/imageformats/hdr.cpp @@ -126,6 +126,7 @@ public: { Header h; + int cnt = 0; int len; QByteArray line(MAXLINE + 1, Qt::Uninitialized); QByteArray format; @@ -167,7 +168,7 @@ public: } } - } while ((len > 0) && (line[0] != '\n')); + } while ((len > 0) && (line[0] != '\n') && (cnt++ < 128)); if (format != "32-bit_rle_rgbe") { qCDebug(HDRPLUGIN) << "Unknown HDR format:" << format;