mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 00:58:15 -04:00
ras: fix crash on broken files
Replace QVector::operator[] with QVector::value() since we can't know for sure the values will be on range so use value() that gives us a 0 if the index is not on range oss-fuzz/13462
This commit is contained in:
parent
297b168a52
commit
20100a1e0e
@ -164,9 +164,9 @@ static bool LoadRAS(QDataStream &s, const RasHeader &ras, QImage &img)
|
||||
quint8 red, green, blue;
|
||||
for (quint32 y = 0; y < ras.Height; y++) {
|
||||
for (quint32 x = 0; x < ras.Width; x++) {
|
||||
red = palette[(int)input[y * ras.Width + x]];
|
||||
green = palette[(int)input[y * ras.Width + x] + (ras.ColorMapLength / 3)];
|
||||
blue = palette[(int)input[y * ras.Width + x] + 2 * (ras.ColorMapLength / 3)];
|
||||
red = palette.value((int)input[y * ras.Width + x]);
|
||||
green = palette.value((int)input[y * ras.Width + x] + (ras.ColorMapLength / 3));
|
||||
blue = palette.value((int)input[y * ras.Width + x] + 2 * (ras.ColorMapLength / 3));
|
||||
img.setPixel(x, y, qRgb(red, green, blue));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user