tga: Don't support more than 8 alpha bits

Fixes undefined left shift with negative values

oss-fuzz/12764
This commit is contained in:
Albert Astals Cid 2019-01-29 12:39:52 +01:00
parent e34f53d6ae
commit 18e17d3a7a

View File

@ -186,6 +186,10 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
// However alpha exists only in the 32 bit format.
if ((tga.pixel_size == 32) && (tga.flags & 0xf)) {
img = QImage(tga.width, tga.height, QImage::Format_ARGB32);
if (numAlphaBits > 8) {
return false;
}
}
uint pixel_size = (tga.pixel_size / 8);