mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 18:07:09 +01:00
engine: imagelib: fix crash when chunk length is more than file size
This commit is contained in:
parent
5c2c02c317
commit
9b001987e9
@ -161,7 +161,14 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
if( chunk_len > INT_MAX )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Image_LoadPNG: Found chunk with wrong size (%s)\n", name );
|
||||
Mem_Free( idat_buf );
|
||||
if( idat_buf ) Mem_Free( idat_buf );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( chunk_len > filesize - ( buf_p - buffer ))
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Image_LoadPNG: Found chunk with size past file size (%s)\n", name );
|
||||
if( idat_buf ) Mem_Free( idat_buf );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user