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



commit 4acc68340803500aa11a6eaf81fc734337e7250e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Aug 3 14:48:29 2013 -0600

    Fix crash on corrupted files.  [#705421]
    
    2013-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (xl_find_conditional_format): There might
        only be a single conditional part!

 NEWS                                  |    2 +-
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   17 +++++++++++------
 3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index 923ab67..bbe3ed9 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ Andreas:
        * Improve import to ODF of empty cells with default column styles. [#704563]
        * Speed up loading of some ODF files. [#704422]
        * Fix ODF style import. [#704563]
-       * Fix crash on corrupted files. [#704636] [#705385]
+       * Fix crash on corrupted files. [#704636] [#705385] [#705421]
        * Fix ODF import of charts with series consisting of multiple ranges. [#704742]
        * Fix ODF export of charts with series consisting of multiple ranges.
        * Implement input message editing. [Part of #705310]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 0a85985..84e6237 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2013-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-write.c (xl_find_conditional_format): There might
+       only be a single conditional part!
+
+2013-08-03  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (odf_validations_translate): NULL validation
        conditions are expected for input-message only situations
 
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 6e83c00..565aa6d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -814,16 +814,21 @@ xl_find_conditional_format (GnmOOExport *state, GOFormat const *format)
 
        if (found == NULL) {
                char *new_found;
-               new_found = g_strdup_printf ("NDC-%i",
-                                            g_hash_table_size (state->xl_styles_conditional));
+               new_found = g_strdup_printf 
+                       ("NDC-%i", g_hash_table_size (state->xl_styles_conditional));
                g_hash_table_insert (state->xl_styles_conditional, g_strdup (xl), new_found);
                found = new_found;
                xl_find_format (state, format, 0);
-               xl_find_format (state, format, 1);
-               condition = go_format_odf_style_map (format, 2);
+               /* We cannot be guaranteed to have a second part. See #705421 */
+               condition = go_format_odf_style_map (format, 1);
                if (condition != NULL) {
-                       xl_find_format (state, format, 2);
-               g_free (condition);
+                       xl_find_format (state, format, 1);
+                       g_free (condition);
+                       condition = go_format_odf_style_map (format, 2);
+                       if (condition != NULL) {
+                               xl_find_format (state, format, 2);
+                               g_free (condition);
+                       }
                }
        }
 


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