handle files too small to be a valid tga!

SVN revision: 10288
This commit is contained in:
Carsten Haitzler 2004-05-20 03:34:27 +00:00
parent 8ca824db74
commit aff90a588d
1 changed files with 5 additions and 0 deletions

View File

@ -236,6 +236,11 @@ load(ImlibImage * im, ImlibProgressFunction progress,
return 0;
}
if (ss.st_size < sizeof(tga_header) + sizeof(tga_footer))
{
close(fd);
return 0;
}
seg = mmap(0, ss.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (seg == MAP_FAILED)
{