forked from old/legacy-imlib2
BMP loader: Fix infinite loop with invalid bmp images (T6749)
https://phab.enlightenment.org/T6749 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773968
This commit is contained in:
parent
5a7644a0c0
commit
51a48ecfe9
|
@ -235,6 +235,17 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
ReadleLong(f, &rmask);
|
||||
ReadleLong(f, &gmask);
|
||||
ReadleLong(f, &bmask);
|
||||
if (bitcount == 16)
|
||||
{
|
||||
rmask &= 0xffffU;
|
||||
gmask &= 0xffffU;
|
||||
bmask &= 0xffffU;
|
||||
}
|
||||
if (rmask == 0 || gmask == 0 || bmask == 0)
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
for (bit = bitcount - 1; bit >= 0; bit--)
|
||||
{
|
||||
if (bmask & (1 << bit))
|
||||
|
|
Loading…
Reference in New Issue