mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-11-22 10:02:43 -05:00
HDR: readHeader() sanity checks
This commit is contained in:
@ -125,14 +125,16 @@ public:
|
|||||||
Header h;
|
Header h;
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int len;
|
int len = 0;
|
||||||
QByteArray line(MAXLINE + 1, Qt::Uninitialized);
|
QByteArray line(MAXLINE, char());
|
||||||
QByteArray format;
|
QByteArray format;
|
||||||
|
|
||||||
// Parse header
|
// Parse header
|
||||||
do {
|
do {
|
||||||
len = device->readLine(line.data(), MAXLINE);
|
len = device->readLine(line.data(), line.size());
|
||||||
|
if (len < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (line.startsWith("FORMAT=")) {
|
if (line.startsWith("FORMAT=")) {
|
||||||
format = line.mid(7, len - 7).trimmed();
|
format = line.mid(7, len - 7).trimmed();
|
||||||
}
|
}
|
||||||
@ -173,7 +175,11 @@ public:
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = device->readLine(line.data(), MAXLINE);
|
len = device->readLine(line.data(), line.size());
|
||||||
|
if (len < 0) {
|
||||||
|
qCDebug(HDRPLUGIN) << "Invalid HDR file, error while reading the first line after the header";
|
||||||
|
return h;
|
||||||
|
}
|
||||||
line.resize(len);
|
line.resize(len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user