gtk+ r19755 - branches/gtk-2-12/gdk-pixbuf



Author: csaavedra
Date: Tue Mar 11 21:00:42 2008
New Revision: 19755
URL: http://svn.gnome.org/viewvc/gtk+?rev=19755&view=rev

Log:
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)



Modified:
   branches/gtk-2-12/gdk-pixbuf/ChangeLog
   branches/gtk-2-12/gdk-pixbuf/io-bmp.c

Modified: branches/gtk-2-12/gdk-pixbuf/io-bmp.c
==============================================================================
--- branches/gtk-2-12/gdk-pixbuf/io-bmp.c	(original)
+++ branches/gtk-2-12/gdk-pixbuf/io-bmp.c	Tue Mar 11 21:00:42 2008
@@ -693,6 +693,8 @@
  */
 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 @@
 	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;
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]