mirror of https://github.com/GNOME/gimp.git
file-gif-load: Fail early in several other places if GetDataBlocks() fails (Bug #737375)
This commit is contained in:
parent
55150487ff
commit
2377c8c2a9
|
@ -492,6 +492,11 @@ load_image (const gchar *filename,
|
|||
GifScreen.Height);
|
||||
}
|
||||
|
||||
if (image_ID < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (comment_parasite != NULL)
|
||||
{
|
||||
if (! thumbnail)
|
||||
|
@ -656,7 +661,7 @@ GetDataBlock (FILE *fd,
|
|||
return -1;
|
||||
}
|
||||
|
||||
ZeroDataBlock = count == 0;
|
||||
ZeroDataBlock = (count == 0);
|
||||
|
||||
if ((count != 0) && (! ReadOK (fd, buf, count)))
|
||||
{
|
||||
|
@ -698,8 +703,15 @@ GetCode (FILE *fd,
|
|||
buf[0] = buf[last_byte - 2];
|
||||
buf[1] = buf[last_byte - 1];
|
||||
|
||||
if ((count = GetDataBlock (fd, &buf[2])) <= 0)
|
||||
done = TRUE;
|
||||
count = GetDataBlock (fd, &buf[2]);
|
||||
if (count < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (count == 0)
|
||||
{
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
last_byte = 2 + count;
|
||||
curbit = (curbit - lastbit) + 16;
|
||||
|
@ -777,6 +789,11 @@ LZWReadByte (FILE *fd,
|
|||
}
|
||||
while (firstcode == clear_code);
|
||||
|
||||
if (firstcode < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return firstcode & 255;
|
||||
}
|
||||
|
||||
|
@ -804,6 +821,11 @@ LZWReadByte (FILE *fd,
|
|||
sp = stack;
|
||||
firstcode = oldcode = GetCode (fd, code_size, FALSE);
|
||||
|
||||
if (firstcode < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return firstcode & 255;
|
||||
}
|
||||
else if (code == end_code || code > max_code)
|
||||
|
@ -865,6 +887,11 @@ LZWReadByte (FILE *fd,
|
|||
return (*--sp) & 255;
|
||||
}
|
||||
|
||||
if (code < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return code & 255;
|
||||
}
|
||||
|
||||
|
@ -1172,6 +1199,11 @@ ReadImage (FILE *fd,
|
|||
break;
|
||||
}
|
||||
|
||||
if (v < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
fini:
|
||||
if (LZWReadByte (fd, FALSE, c) >= 0)
|
||||
g_print ("GIF: too much input data, ignoring extra...\n");
|
||||
|
|
Loading…
Reference in New Issue