mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-17 11:44:16 -04:00
tga: memset dst if read fails
This commit is contained in:
@ -257,7 +257,14 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
|
|||||||
} else {
|
} else {
|
||||||
// Raw pixels.
|
// Raw pixels.
|
||||||
count *= pixel_size;
|
count *= pixel_size;
|
||||||
s.readRawData(dst, count);
|
const int dataRead = s.readRawData(dst, count);
|
||||||
|
if (dataRead < 0) {
|
||||||
|
free(image);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((uint)dataRead < count) {
|
||||||
|
memset(&dst[dataRead], 0, count - dataRead);
|
||||||
|
}
|
||||||
dst += count;
|
dst += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user