Commit 61857770 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent dc1a2846
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
......
......@@ -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;
return TRUE;
/* Note that this requires xpm to be checked before xbm. */
if (buffer [0] == '/'
&& buffer [1] != '*')
return TRUE;
return FALSE;
}
static gboolean
......
......@@ -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);
......
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