]> Pileus Git - ~andy/gtk/commitdiff
Set the GError if the image is zero length. (#405327)
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 7 Feb 2007 14:47:36 +0000 (14:47 +0000)
committerChris Wilson <cpwilson@src.gnome.org>
Wed, 7 Feb 2007 14:47:36 +0000 (14:47 +0000)
2007-02-07  Chris Wilson  <chris@chris-wilson.co.uk>

* io-jpeg.c: (gdk_pixbuf__jpeg_image_load),
(gdk_pixbuf__jpeg_image_load_increment): Set the GError
if the image is zero length. (#405327)

svn path=/trunk/; revision=17272

gdk-pixbuf/ChangeLog
gdk-pixbuf/io-jpeg.c

index 08dc7f77a60ac1d7edcc3324c1b0756d9fb151c4..94415d916f82ce0649a4244b8071f18898a6b4c2 100644 (file)
@@ -1,3 +1,9 @@
+2007-02-07  Chris Wilson  <chris@chris-wilson.co.uk>
+
+       * io-jpeg.c: (gdk_pixbuf__jpeg_image_load),
+       (gdk_pixbuf__jpeg_image_load_increment): Set the GError
+       if the image is zero length. (#405327)
+
 2007-02-06  Matthias Clasen  <mclasen@redhat.com>
 
        * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Protect
index 52c17d51120ed03b5866b433f602c8cb8de42782..cd11ebc9cfe141dd2eb73056c22a2b96a4b26b2a 100644 (file)
@@ -307,6 +307,8 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
                        g_object_unref (pixbuf);
 
                jpeg_destroy_decompress (&cinfo);
+
+               /* error should have been set by fatal_error_handler () */
                return NULL;
        }
 
@@ -715,8 +717,13 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
                        height = cinfo->image_height;
                        if (context->size_func) {
                                (* context->size_func) (&width, &height, context->user_data);
-                               if (width == 0 || height == 0)
+                               if (width == 0 || height == 0) {
+                                       g_set_error (error,
+                                                    GDK_PIXBUF_ERROR,
+                                                    GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                                    _("Transformed JPEG has zero width or height."));
                                        return FALSE;
+                               }
                        }
                        
                        for (cinfo->scale_denom = 2; cinfo->scale_denom <= 8; cinfo->scale_denom *= 2) {