forked from old/legacy-imlib2
loader_tga.c: Properly signal if decoding RLE compressed data failed
Otherwise uninitilized memory could be used later on. I don't have a test file for this commit.
This commit is contained in:
parent
2fdef015ff
commit
6ef51ec4cd
|
@ -413,11 +413,17 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
DATA32 *final_pixel = dataptr + im->w * im->h;
|
||||
|
||||
/* loop until we've got all the pixels or run out of input */
|
||||
while ((dataptr < final_pixel) &&
|
||||
((bufptr + 1 + (bpp / 8)) <= bufend))
|
||||
while ((dataptr < final_pixel))
|
||||
{
|
||||
int count;
|
||||
|
||||
if ((bufptr + 1 + (bpp / 8)) > bufend)
|
||||
{
|
||||
munmap(seg, ss.st_size);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
curbyte = *bufptr++;
|
||||
count = (curbyte & 0x7F) + 1;
|
||||
|
||||
|
@ -471,9 +477,14 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; (i < count) && (dataptr < final_pixel) &&
|
||||
((bufptr + (bpp / 8)) <= bufend); i++)
|
||||
for (i = 0; (i < count) && (dataptr < final_pixel); i++)
|
||||
{
|
||||
if ((bufptr + 1 + (bpp / 8)) > bufend)
|
||||
{
|
||||
munmap(seg, ss.st_size);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
switch (bpp)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue