mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
tga: Don't support more than 8 alpha bits
Fixes undefined left shift with negative values oss-fuzz/12764
This commit is contained in:
parent
e34f53d6ae
commit
18e17d3a7a
@ -186,6 +186,10 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
|
|||||||
// However alpha exists only in the 32 bit format.
|
// However alpha exists only in the 32 bit format.
|
||||||
if ((tga.pixel_size == 32) && (tga.flags & 0xf)) {
|
if ((tga.pixel_size == 32) && (tga.flags & 0xf)) {
|
||||||
img = QImage(tga.width, tga.height, QImage::Format_ARGB32);
|
img = QImage(tga.width, tga.height, QImage::Format_ARGB32);
|
||||||
|
|
||||||
|
if (numAlphaBits > 8) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint pixel_size = (tga.pixel_size / 8);
|
uint pixel_size = (tga.pixel_size / 8);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user