mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-11-22 10:02:43 -05:00
dds: Fix assert when reading broken data
oss-fuzz testcase 6027629841154048
This commit is contained in:
@ -1126,7 +1126,11 @@ static QImage readR32F(QDataStream &s, const quint32 width, const quint32 height
|
|||||||
for (quint32 y = 0; y < height; y++) {
|
for (quint32 y = 0; y < height; y++) {
|
||||||
float *line = reinterpret_cast<float *>(image.scanLine(y));
|
float *line = reinterpret_cast<float *>(image.scanLine(y));
|
||||||
for (quint32 x = 0; x < width; x++) {
|
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 + 1] = 0;
|
||||||
line[x * 4 + 2] = 0;
|
line[x * 4 + 2] = 0;
|
||||||
line[x * 4 + 3] = 1;
|
line[x * 4 + 3] = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user