summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-gif.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2001-09-14 22:04:55 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2001-09-14 22:04:55 +0000
commit49b3e05a30bb7de83f3c1016d11ee7e482f439a5 (patch)
treeb3cafb1c7355ae8a6fbd4e6ca94ab2d6b2010f8a /gdk-pixbuf/io-gif.c
parenta5f9754350e803af7838a3c98a34418077e52fbb (diff)
downloadgdk-pixbuf-49b3e05a30bb7de83f3c1016d11ee7e482f439a5.tar.gz
Robustness fixes and test images for the jpeg, tiff, pnm, gif, xpm and tga
loaders.
Diffstat (limited to 'gdk-pixbuf/io-gif.c')
-rw-r--r--gdk-pixbuf/io-gif.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 68dcaa430..62cea01d2 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -613,6 +613,14 @@ lzw_read_byte (GifContext *context)
}
while (code >= context->lzw_clear_code) {
+ if ((code >= (1 << MAX_LZW_BITS))
+ || (context->lzw_sp >= context->lzw_stack + ((1 << (MAX_LZW_BITS)) * 2 + 1))) {
+ g_set_error (context->error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Bad code encountered"));
+ return -2;
+ }
*(context->lzw_sp)++ = context->lzw_table[1][code];
if (code == context->lzw_table[0][code]) {
@@ -1038,7 +1046,7 @@ gif_init (GifContext *context)
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("File does not appear to be a GIF file"));
- return -1;
+ return -2;
}
strncpy (version, (char *) buf + 3, 3);
@@ -1051,7 +1059,7 @@ gif_init (GifContext *context)
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Version %s of the GIF file format is not supported"),
version);
- return -1;
+ return -2;
}
/* read the screen descriptor */