[gdk-pixbuf/gdk-pixbuf-2-28] ANI: Set an error if we fail to produce an animation



commit b268d4e8ba9c1a74881bb4edab65d5a32fd27de6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 7 14:19:31 2013 -0400

    ANI: Set an error if we fail to produce an animation
    
    Otherwise we trip up an assertion in gdk_pixbuf_animation_new_from_file.

 gdk-pixbuf/io-ani.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c
index 6e72948..48752fa 100644
--- a/gdk-pixbuf/io-ani.c
+++ b/gdk-pixbuf/io-ani.c
@@ -612,6 +612,7 @@ gdk_pixbuf__ani_image_begin_load (GdkPixbufModuleSizeFunc size_func,
         context->byte = context->buffer;
         context->n_bytes = 0;
         
+g_print ("begin load\n");
         return (gpointer) context;
 }
 
@@ -620,11 +621,22 @@ gdk_pixbuf__ani_image_stop_load (gpointer data,
                                 GError **error)
 {
         AniLoaderContext *context = (AniLoaderContext *) data;
-        
+        gboolean retval;
+
        g_return_val_if_fail (context != NULL, TRUE);
+        if (!context->animation) {
+                g_set_error_literal (error,
+                                     GDK_PIXBUF_ERROR,
+                                     GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+                                     _("ANI image was truncated or incomplete."));
+                retval = FALSE;
+        }
+        else {
+                retval = TRUE;
+        }
         context_free (context);
-        
-        return TRUE;
+
+        return retval;
 }
 
 #ifndef INCLUDE_ani


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