refuse to load file exceeding 9999x9999 pixels.

Prevent crashing when a GIf file pretends to be 50000x50000
This commit is contained in:
Thomas Bernard 2018-12-17 21:50:40 +01:00
parent 3bfa777d23
commit 617e4da310
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -335,6 +335,12 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
char str[10]; char str[10];
byte truecolor; byte truecolor;
if (width < 0 || width > 9999 || height < 0 || height > 9999)
{
File_error = 1;
return;
}
if (bpp == 0) if (bpp == 0)
bpp = 8; // default to 8bits bpp = 8; // default to 8bits
truecolor = (bpp > 8) ? 1 : 0; truecolor = (bpp > 8) ? 1 : 0;