summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2002-05-31 23:42:33 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2002-05-31 23:42:33 +0000
commit61857770ce695f7316b0b3ab338478570b93f221 (patch)
treed3c2aed836058bdfecc46a23312c8448af176c16 /gdk-pixbuf
parentdc1a2846cf84a3e81d327a9be60878bac8e8d49e (diff)
downloadgtk+-61857770ce695f7316b0b3ab338478570b93f221.tar.gz
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.
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/ChangeLog10
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c25
-rw-r--r--gdk-pixbuf/io-xbm.c2
3 files changed, 27 insertions, 10 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 1de74afbe0..e81f8ab48b 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -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
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index b0e03319a8..b32da24dbe 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -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
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
index d1a087e447..3ef06bb2a8 100644
--- a/gdk-pixbuf/io-xbm.c
+++ b/gdk-pixbuf/io-xbm.c
@@ -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);