[gnumeric] Fix crash on corrupted files. [#703625]



commit 63f9bd1fb918ab3ce76c858132c7962563c491b8
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jul 4 13:28:24 2013 -0600

    Fix crash on corrupted files.  [#703625]
    
    2013-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * src/sheet-object-image.c (gnm_soi_assign_to_sheet): do not try
        to create an image of unknown type

 ChangeLog                |    5 +++++
 NEWS                     |    2 +-
 src/sheet-object-image.c |   13 ++++++++-----
 3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 33d6512..f4beaad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-04  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * src/sheet-object-image.c (gnm_soi_assign_to_sheet): do not try
+       to create an image of unknown type
+
 2013-07-03  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * src/graph.c (gnm_go_data_vector_load_len): use consistent
diff --git a/NEWS b/NEWS
index c586ad5..12ea2b2 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ Andreas:
        * Improve xls import of Excel 2010 functions.
        * Fix documentation of r.q* and r.*nbinom. [#703164]
        * Add Excel 2010's BETA.DIST.
-       * Fix crash on corrupted files. [#703149] [#703215]
+       * Fix crash on corrupted files. [#703149] [#703215] [#703625]
        * Fix import of sxc files. [#703249]
        * Fix TDIST Import/Export from/to ODF.
        * Write manual legend position to ODF. [#703362]
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 4bb8a73..4531e67 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -281,7 +281,8 @@ gnm_soi_get_target_list (SheetObject const *so)
 }
 
 static void
-gnm_soi_write_image (SheetObject const *so, char const *format, double resolution,
+gnm_soi_write_image (SheetObject const *so, char const *format, 
+                    G_GNUC_UNUSED double resolution,
                     GsfOutput *output, GError **err)
 {
        SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
@@ -401,10 +402,11 @@ content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
 
 static void
 gnm_soi_prep_sax_parser (SheetObject *so, GsfXMLIn *xin,
-                        xmlChar const **attrs, GnmConventions const *convs)
+                        xmlChar const **attrs,
+                        G_GNUC_UNUSED GnmConventions const *convs)
 {
        static GsfXMLInNode const dtd[] = {
-         GSF_XML_IN_NODE (CONTENT, CONTENT, -1, "Content",     GSF_XML_CONTENT, &content_start, 
&content_end),
+         GSF_XML_IN_NODE (CONTENT, CONTENT, -1, "Content", GSF_XML_CONTENT, &content_start, &content_end),
          GSF_XML_IN_NODE_END
        };
        static GsfXMLInDoc *doc = NULL;
@@ -424,7 +426,7 @@ gnm_soi_prep_sax_parser (SheetObject *so, GsfXMLIn *xin,
 
 static void
 gnm_soi_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
-                      GnmConventions const *convs)
+                      G_GNUC_UNUSED GnmConventions const *convs)
 {
        SheetObjectImage *soi;
 
@@ -561,7 +563,8 @@ gnm_soi_assign_to_sheet (SheetObject *so, Sheet *sheet)
        } else if (soi->name) {
                GODoc *doc = GO_DOC (sheet->workbook);
                GType type = go_image_type_for_format (soi->type);
-               soi->image = g_object_ref (go_doc_image_fetch (doc, soi->name, type));
+               if (type != 0)
+                       soi->image = g_object_ref (go_doc_image_fetch (doc, soi->name, type));
        } else {
                /* There is nothing we can do */
        }


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