Accept xbms starting with a C comment - those seem to be not uncommon,

* gdk-pixbuf-io.c (pixbuf_check_xbm): Accept xbms starting
	with a C comment - those seem to be not uncommon, e.g. the Gimp
	produces them.  (#82706)

	* io-xbm.c (read_bitmap_file_data): Don't leak memory on certain
	invalid inputs.
	(gdk_pixbuf__xbm_image_load_real): Don't leak memory on valid inputs.
This commit is contained in:
Matthias Clasen 2002-05-31 23:42:33 +00:00
parent dc1a2846cf
commit 61857770ce
3 changed files with 27 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2002-06-01 Matthias Clasen <maclas@gmx.de>
* gdk-pixbuf-io.c (pixbuf_check_xbm): Accept xbms starting
with a C comment - those seem to be not uncommon, e.g. the Gimp
produces them. (#82706)
* io-xbm.c (read_bitmap_file_data): Don't leak memory on certain
invalid inputs.
(gdk_pixbuf__xbm_image_load_real): Don't leak memory on valid inputs.
2002-05-22 Tor Lillqvist <tml@iki.fi>
* gdk-pixbuf-io.c (get_libdir): Use GTK_BINARY_VERSION (and not

View File

@ -193,17 +193,22 @@ pixbuf_check_xbm (guchar *buffer, int size)
if (size < 20)
return FALSE;
if (buffer [0] != '#'
|| buffer [1] != 'd'
|| buffer [2] != 'e'
|| buffer [3] != 'f'
|| buffer [4] != 'i'
|| buffer [5] != 'n'
|| buffer [6] != 'e'
|| buffer [7] != ' ')
return FALSE;
if (buffer [0] == '#'
&& buffer [1] == 'd'
&& buffer [2] == 'e'
&& buffer [3] == 'f'
&& buffer [4] == 'i'
&& buffer [5] == 'n'
&& buffer [6] == 'e'
&& buffer [7] == ' ')
return TRUE;
/* Note that this requires xpm to be checked before xbm. */
if (buffer [0] == '/'
&& buffer [1] != '*')
return TRUE;
return FALSE;
}
static gboolean

View File

@ -244,6 +244,7 @@ read_bitmap_file_data (FILE *fstream,
*ptr=value;
}
}
break;
}
if (!bits)
@ -323,6 +324,7 @@ gdk_pixbuf__xbm_image_load_real (FILE *f, XBMData *context, GError **error)
}
pixels += row_stride;
}
g_free (data);
if (context) {
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);