forked from old/legacy-imlib2
loader_tga: Abort file loading if the file obviously isn't large enough
Prevents an integer overflow later on that resulted in a datasize of 18446744073709551575 for id:000131,src:000104,op:havoc,rep:32,+cov whose actual size is 48 byte.
This commit is contained in:
parent
a104e317ce
commit
a2cb5b9c9b
|
@ -237,6 +237,14 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
{
|
||||
}
|
||||
|
||||
if ((size_t)ss.st_size < sizeof(tga_header) + header->idLength +
|
||||
(footer_present ? sizeof(tga_footer) : 0))
|
||||
{
|
||||
munmap(seg, ss.st_size);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* skip over header */
|
||||
filedata = (char *)filedata + sizeof(tga_header);
|
||||
|
||||
|
|
Loading…
Reference in New Issue