summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-ico.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-08-18 14:18:02 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-08-18 14:18:02 +0000
commit485b4f523f5cdfbc1d93203239710ba3c2f78ee1 (patch)
treee26b216e4f61422a60f83f65bfb282f0cb2cc2ae /gdk-pixbuf/io-ico.c
parent86685d2ad03b3b88ee546f3fd4d32cedcec74e32 (diff)
downloadgtk+-485b4f523f5cdfbc1d93203239710ba3c2f78ee1.tar.gz
Check for overflow in one more place. (#313818, Tommi Komulainen)
2005-08-18 Matthias Clasen <mclasen@redhat.com> * io-ico.c (DecodeHeader): Check for overflow in one more place. (#313818, Tommi Komulainen)
Diffstat (limited to 'gdk-pixbuf/io-ico.c')
-rw-r--r--gdk-pixbuf/io-ico.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 21f34b2a1b..812683daa6 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -261,7 +261,15 @@ static void DecodeHeader(guchar *Data, gint Bytes,
so we know how many bytes are in the "header" part. */
State->HeaderSize = State->DIBoffset + 40; /* 40 = sizeof(InfoHeader) */
-
+
+ if (State->HeaderSize < 0) {
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Invalid header in icon"));
+ return;
+ }
+
if (State->HeaderSize>State->BytesInHeaderBuf) {
guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
if (!tmp) {