diff options
author | Claudio Saavedra <csaavedra@alumnos.utalca.cl> | 2008-03-11 21:06:59 +0000 |
---|---|---|
committer | Claudio Saavedra <csaavedra@src.gnome.org> | 2008-03-11 21:06:59 +0000 |
commit | d1639c8730d043c862bb63471b08d12d9336414c (patch) | |
tree | 7a0717c691fd97e98379f0ef57f6e2077a5f985f /gdk-pixbuf | |
parent | 9aa1be5a0dc032736ebf68742339cae00ad55e8c (diff) | |
download | gdk-pixbuf-d1639c8730d043c862bb63471b08d12d9336414c.tar.gz |
Set a GDK_ERROR_CORRUPT_IMAGE error if the loader is closed while still
2008-03-11 Claudio Saavedra <csaavedra@alumnos.utalca.cl>
* io-bmp.c: (gdk_pixbuf__bmp_image_stop_load): Set a
GDK_ERROR_CORRUPT_IMAGE error if the loader is closed while
still reading the headers. (#505085)
svn path=/trunk/; revision=19757
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r-- | gdk-pixbuf/ChangeLog | 6 | ||||
-rw-r--r-- | gdk-pixbuf/io-bmp.c | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 3c507d472..d8e689776 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,5 +1,11 @@ 2008-03-11 Claudio Saavedra <csaavedra@alumnos.utalca.cl> + * io-bmp.c: (gdk_pixbuf__bmp_image_stop_load): Set a + GDK_ERROR_CORRUPT_IMAGE error if the loader is closed while + still reading the headers. (#505085) + +2008-03-11 Claudio Saavedra <csaavedra@alumnos.utalca.cl> + * io-bmp.c: (DecodeHeader): Check for the BMP header magic numbers before decoding it. (#505085) diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index 099a16d96..278c1ba99 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -693,6 +693,8 @@ gdk_pixbuf__bmp_image_begin_load(GdkPixbufModuleSizeFunc size_func, */ static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error) { + gboolean retval = TRUE; + struct bmp_progressive_state *context = (struct bmp_progressive_state *) data; @@ -707,10 +709,20 @@ static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error) if (context->pixbuf) g_object_unref(context->pixbuf); + if (context->read_state == READ_STATE_HEADERS) { + if (error && *error == NULL) { + g_set_error (error, + GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_CORRUPT_IMAGE, + _("Premature end-of-file encountered")); + } + retval = FALSE; + } + g_free(context->buff); g_free(context); - return TRUE; + return retval; } |