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



commit 7d98c55679857a0f1a9c20ed41bd5cbc5a21d14e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Jun 15 01:22:05 2013 -0600

    Fix crash on corrupted files.   [#702288]
    
    2013-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_page_layout): always set state->print.cur_pi
        (odf_master_page): ditto

 NEWS                                 |    2 +-
 plugins/openoffice/ChangeLog         |    5 ++++
 plugins/openoffice/openoffice-read.c |   40 ++++++++++++++++++---------------
 3 files changed, 28 insertions(+), 19 deletions(-)
---
diff --git a/NEWS b/NEWS
index 350bc55..d56e826 100644
--- a/NEWS
+++ b/NEWS
@@ -23,7 +23,7 @@ Andreas:
          export [#702169]
        * Fix ODF crash. [#702197]
        * In ODF import ignored mentioned but not included sheets. [#698388]
-       * Fix crash on corrupted files.  [#702205] [#702219] [#702285]
+       * Fix crash on corrupted files.  [#702205] [#702219] [#702285] [#702288]
        * Some documentation improvements. [Debian #621735] [Debian #530462] 
 
 Darrell Tangman:
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 04774ed..20b38b8 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_page_layout): always set state->print.cur_pi
+       (odf_master_page): ditto
+
 2013-06-14  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (odf_custom_shape_end): consider the possibility
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 35eda98..cd92c80 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5657,11 +5657,13 @@ odf_page_layout (GsfXMLIn *xin, xmlChar const **attrs)
                if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_STYLE, "name"))
                        name = CXML2C (attrs[1]);
 
-       if (name != NULL) {
-               state->print.cur_pi = print_information_new (TRUE);
-               g_hash_table_insert (state->styles.page_layouts, g_strdup (name), state->print.cur_pi);
-       } else
+       if (name == NULL) {
                oo_warning (xin, _("Missing page layout identifier"));
+               name = "Missing page layout identifier";
+       }
+       state->print.cur_pi = print_information_new (TRUE);
+       g_hash_table_insert (state->styles.page_layouts, g_strdup (name), 
+                            state->print.cur_pi);
 }
 
 static void
@@ -5687,23 +5689,25 @@ odf_master_page (GsfXMLIn *xin, xmlChar const **attrs)
                                             OO_NS_STYLE, "page-layout-name"))
                        pl_name = CXML2C (attrs[1]);
 
-       if (name != NULL) {
-               if (pl_name != NULL)
-                       pi = g_hash_table_lookup (state->styles.page_layouts, pl_name);
-               if (pi == NULL) {
-                       oo_warning (xin, _("Master page style without page layout encountered!"));
-                       state->print.cur_pi = print_information_new (TRUE);
-               } else
-                       state->print.cur_pi = print_info_dup (pi);
-               print_hf_free (state->print.cur_pi->header);
-               print_hf_free (state->print.cur_pi->footer);
-               state->print.cur_pi->header = print_hf_new (NULL, NULL, NULL);
-               state->print.cur_pi->footer = print_hf_new (NULL, NULL, NULL);
-
-               g_hash_table_insert (state->styles.master_pages, g_strdup (name), state->print.cur_pi);
+       if (pl_name != NULL)
+               pi = g_hash_table_lookup (state->styles.page_layouts, pl_name);
+       if (pi == NULL) {
+               oo_warning (xin, _("Master page style without page layout encountered!"));
+               state->print.cur_pi = print_information_new (TRUE);
        } else
+               state->print.cur_pi = print_info_dup (pi);
+
+       if (name == NULL) {
                oo_warning (xin, _("Master page style without name encountered!"));
+               name = "Master page style without name encountered!";
+       }
 
+       print_hf_free (state->print.cur_pi->header);
+       print_hf_free (state->print.cur_pi->footer);
+       state->print.cur_pi->header = print_hf_new (NULL, NULL, NULL);
+       state->print.cur_pi->footer = print_hf_new (NULL, NULL, NULL);
+       
+       g_hash_table_insert (state->styles.master_pages, g_strdup (name), state->print.cur_pi);
 }
 
 static void


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