Commit 5a85d5e7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

applied a patch from David Costanzo that adds missing error handling to

2005-04-30  Sven Neumann  <sven@gimp.org>

	* plug-ins/bmp/bmpread.c: applied a patch from David Costanzo that
	adds missing error handling to the BMP loader, allowing it to deal
	gracefully with incomplete BMP image files.
parent 342c4e21
2005-04-30 Sven Neumann <sven@gimp.org>
* plug-ins/bmp/bmpread.c: applied a patch from David Costanzo that
adds missing error handling to the BMP loader, allowing it to deal
gracefully with incomplete BMP image files.
2005-04-29 Sven Neumann <sven@gimp.org>
* plug-ins/winicon/icodialog.c
......
......@@ -613,7 +613,12 @@ ReadImage (FILE *fd,
/* compressed image (either RLE8 or RLE4) */
while (ypos >= 0 && xpos <= width)
{
ReadOK (fd, buffer, 2);
if (!ReadOK (fd, buffer, 2))
{
g_message (_("The bitmap ends unexpectedly."));
break;
}
if ((guchar) buffer[0] != 0)
/* Count + Color - record */
{
......@@ -647,7 +652,11 @@ ReadImage (FILE *fd,
for (j = 0; j < n; j += (8 / bpp))
{
/* read the next byte in the record */
ReadOK (fd, &v, 1);
if (!ReadOK (fd, &v, 1))
{
g_message (_("The bitmap ends unexpectedly."));
break;
}
total_bytes_read++;
/* read all pixels from that byte */
......@@ -692,7 +701,11 @@ ReadImage (FILE *fd,
if (((guchar) buffer[0]==0) && ((guchar) buffer[1]==2))
/* Deltarecord */
{
ReadOK (fd, buffer, 2);
if (!ReadOK (fd, buffer, 2))
{
g_message (_("The bitmap ends unexpectedly."));
break;
}
xpos += (guchar) buffer[0];
ypos -= (guchar) buffer[1];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment