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



commit 0cf19afe11c3f275e43dfe26b144ba7146403244
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jul 29 11:24:31 2013 -0600

    Fix crash on corrupted files. [#705031]
    
    2013-07-29  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * xlsx-write.c (xlsx_write_borders): check for NULL borders

 NEWS                       |    2 +-
 plugins/excel/ChangeLog    |    4 ++++
 plugins/excel/xlsx-write.c |    8 ++++----
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0b04950..e023091 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]
+       * Fix crash on corrupted files. [#704636] [#705032] [#705031]
        * Fix ODF import of charts with series consisting of multiple ranges. [#704742]
        * Fix ODF export of charts with series consisting of multiple ranges.
 
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index b433f19..49c723d 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-29  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * xlsx-write.c (xlsx_write_borders): check for NULL borders
+
 2013-07-26  Morten Welinder  <terra gnome org>
 
        * xlsx-read.c (xlsx_file_open): Release state.val, just in case.
diff --git a/plugins/excel/xlsx-write.c b/plugins/excel/xlsx-write.c
index 5466d0e..823f32b 100644
--- a/plugins/excel/xlsx-write.c
+++ b/plugins/excel/xlsx-write.c
@@ -784,14 +784,14 @@ xlsx_write_borders (XLSXWriteState *state, GsfXMLOut *xml)
                                        (style, MSTYLE_BORDER_DIAGONAL);
                                gsf_xml_out_add_bool
                                        (xml, "diagonalUp",
-                                        (border->line_type != GNM_STYLE_BORDER_NONE));
+                                        (border && border->line_type != GNM_STYLE_BORDER_NONE));
                        }
                        if (gnm_style_is_element_set (style, MSTYLE_BORDER_REV_DIAGONAL)) {
                                GnmBorder *border = gnm_style_get_border
                                        (style, MSTYLE_BORDER_REV_DIAGONAL);
                                gsf_xml_out_add_bool
                                        (xml, "diagonalDown",
-                                        (border->line_type != GNM_STYLE_BORDER_NONE));
+                                        (border && border->line_type != GNM_STYLE_BORDER_NONE));
                        }
                        if (gnm_style_is_element_set (style, MSTYLE_BORDER_LEFT))
                                xlsx_write_border (state, xml,
@@ -816,7 +816,7 @@ xlsx_write_borders (XLSXWriteState *state, GsfXMLOut *xml)
                        if (gnm_style_is_element_set (style, MSTYLE_BORDER_DIAGONAL)) {
                                GnmBorder *border = gnm_style_get_border
                                        (style, MSTYLE_BORDER_DIAGONAL);
-                               if (border->line_type != GNM_STYLE_BORDER_NONE) {
+                               if (border && border->line_type != GNM_STYLE_BORDER_NONE) {
                                        diagonal_border_written = TRUE;
                                        xlsx_write_border (state, xml,
                                                   border,
@@ -827,7 +827,7 @@ xlsx_write_borders (XLSXWriteState *state, GsfXMLOut *xml)
                            gnm_style_is_element_set (style, MSTYLE_BORDER_REV_DIAGONAL)) {
                                GnmBorder *border = gnm_style_get_border
                                        (style, MSTYLE_BORDER_REV_DIAGONAL);
-                               if (border->line_type != GNM_STYLE_BORDER_NONE) {
+                               if (border && border->line_type != GNM_STYLE_BORDER_NONE) {
                                        xlsx_write_border (state, xml,
                                                   border,
                                                   MSTYLE_BORDER_REV_DIAGONAL);


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