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



commit f5dae247fba6faac457c56f59a3c8b501e555cf7
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jul 29 23:57:37 2013 -0600

    Fix crash on corrupted files.  [#705101]
    
    2013-07-30  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (od_draw_object): clear chart.i_plot_styles

 NEWS                                 |    2 +-
 plugins/openoffice/ChangeLog         |    4 ++++
 plugins/openoffice/openoffice-read.c |   13 +++++++++----
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 16e82b4..2813103 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] [#705032] [#705031]
+       * Fix crash on corrupted files. [#704636] [#705032] [#705031] [#705101]
        * Fix ODF import of charts with series consisting of multiple ranges. [#704742]
        * Fix ODF export of charts with series consisting of multiple ranges.
        * Do not show placeholders in function tooltip. [#705049]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 78b0773..00165c4 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-30  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (od_draw_object): clear chart.i_plot_styles
+
 2013-07-29  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_print_spreadsheet_content_validations): write
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 4623bca..30eff3e 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -7557,6 +7557,7 @@ od_draw_object (GsfXMLIn *xin, xmlChar const **attrs)
        gchar * name;
        gint name_len;
        GsfInput        *content = NULL;
+       int i;
 
        if (state->chart.so != NULL) {
                if (IS_SHEET_OBJECT_GRAPH (state->chart.so))
@@ -7588,6 +7589,9 @@ od_draw_object (GsfXMLIn *xin, xmlChar const **attrs)
                = g_slist_prepend (state->chart.saved_gradient_styles,
                                   state->chart.gradient_styles);
 
+       for (i = 0; i < OO_CHART_STYLE_INHERITANCE; i++)
+               state->chart.i_plot_styles[i] = NULL;
+
        state->chart.graph_styles = g_hash_table_new_full
                (g_str_hash, g_str_equal,
                 (GDestroyNotify) g_free,
@@ -7637,7 +7641,6 @@ od_draw_object (GsfXMLIn *xin, xmlChar const **attrs)
                GsfXMLInDoc *doc =
                        gsf_xml_in_doc_new (get_styles_dtd (),
                                            gsf_odf_get_ns ());
-               odf_clear_conventions (state); /* contain references to xin */
                gsf_xml_in_doc_parse (doc, content, state);
                gsf_xml_in_doc_free (doc);
                odf_clear_conventions (state); /* contain references to xin */
@@ -7648,7 +7651,6 @@ od_draw_object (GsfXMLIn *xin, xmlChar const **attrs)
        if (content != NULL) {
                GsfXMLInDoc *doc =
                        gsf_xml_in_doc_new (get_dtd (), gsf_odf_get_ns ());
-               odf_clear_conventions (state); /* contain references to xin */
                gsf_xml_in_doc_parse (doc, content, state);
                gsf_xml_in_doc_free (doc);
                odf_clear_conventions (state); /* contain references to xin */
@@ -7663,6 +7665,9 @@ od_draw_object (GsfXMLIn *xin, xmlChar const **attrs)
                state->cur_style.type = OO_STYLE_UNKNOWN;
        state->chart.cur_graph_style = NULL;
 
+       for (i = 0; i < OO_CHART_STYLE_INHERITANCE; i++)
+               state->chart.i_plot_styles[i] = NULL;
+
        pop_hash (&state->chart.saved_graph_styles, &state->chart.graph_styles);
        pop_hash (&state->chart.saved_hatches, &state->chart.hatches);
        pop_hash (&state->chart.saved_dash_styles, &state->chart.dash_styles);
@@ -12288,8 +12293,8 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
        state.chart.cs_viewbox = NULL;
        state.chart.cs_type = NULL;
        state.chart.cs_variables = NULL;
-       state.chart.i_plot_styles[OO_CHART_STYLE_PLOTAREA] = NULL;
-       state.chart.i_plot_styles[OO_CHART_STYLE_SERIES] = NULL;
+       for (i = 0; i < OO_CHART_STYLE_INHERITANCE; i++)
+               state.chart.i_plot_styles[i] = NULL;
        state.styles.sheet = g_hash_table_new_full (g_str_hash, g_str_equal,
                (GDestroyNotify) g_free,
                (GDestroyNotify) oo_sheet_style_free);


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