[goffice] Fix crash on corrupted GOImage. [#703670]



commit d57a5c341010ba1df01b272177bf5362204bd3d3
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jul 5 15:12:01 2013 -0600

    Fix crash on corrupted GOImage. [#703670]
    
    2013-07-05 Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * goffice/app/go-doc.c (load_image): check for NULL attrs

 ChangeLog            |    4 ++++
 NEWS                 |    3 +++
 goffice/app/go-doc.c |    8 ++++----
 3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2a5279d..f592ea7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-05 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * goffice/app/go-doc.c (load_image): check for NULL attrs
+
 2013-07-05  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/app/go-doc.c (go_doc_image_fetch): make it more secure.
diff --git a/NEWS b/NEWS
index d97b328..a14e54b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.10.4:
 
+Andreas
+       * Fix crash on corrupted GOImage. [#703670]
+
 --------------------------------------------------------------------------
 goffice 0.10.3:
 
diff --git a/goffice/app/go-doc.c b/goffice/app/go-doc.c
index c7161c4..7281dfd 100644
--- a/goffice/app/go-doc.c
+++ b/goffice/app/go-doc.c
@@ -496,7 +496,7 @@ go_doc_init_read (GODoc *doc, GsfInput *input)
 }
 
 static void
-save_image_cb (gpointer key, gpointer img_, gpointer user)
+save_image_cb (G_GNUC_UNUSED gpointer key, gpointer img_, gpointer user)
 {
        go_image_save ((GOImage *) img_, (GsfXMLOut *) user);
 }
@@ -549,9 +549,9 @@ load_image (GsfXMLIn *xin, xmlChar const **attrs)
 {
        GODoc *doc = GO_DOC (xin->user_state);
        GOImage *image = NULL;
-       xmlChar const **attr =  attrs;
+       xmlChar const **attr;
        GType type = 0;
-       if (!*attr)
+       if (!attrs || !*attrs)
                return;
        for (attr = attrs; *attr; attr += 2)
                if (!strcmp (*attr, "name"))
@@ -566,7 +566,7 @@ load_image (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
-load_image_data (GsfXMLIn *xin, GsfXMLBlob *unknown)
+load_image_data (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
 {
        GODoc *doc = GO_DOC (xin->user_state);
        GOImage *image = GO_IMAGE (g_object_get_data (G_OBJECT (doc), "new image")), *real;



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