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
This commit is contained in:
Mirco Miranda
2025-09-09 15:59:14 +02:00
committed by Albert Astals Cid
parent 463da81fad
commit 6881e3111b

View File

@ -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;