[gnumeric] Fix a crash on xslx import (don't set the print flag for a NULL object).



commit d9b7cb29d1fa15854b0a63c9e63979ae1956ea82
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed May 27 16:18:04 2020 +0200

    Fix a crash on xslx import (don't set the print flag for a NULL object).

 ChangeLog                         | 5 +++++
 plugins/excel/ChangeLog           | 5 +++++
 plugins/excel/xlsx-read-drawing.c | 3 +++
 src/sheet-object.c                | 2 ++
 4 files changed, 15 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index 9583b1869..52d907bf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-27  Jean Brefort  <jean brefort normalesup org>
+
+       * src/sheet-object.c (sheet_object_set_print_flag): protect against a NULL
+       object.
+
 2020-05-09  Morten Welinder <terra gnome org>
 
        * configure.ac: Post-release bump.
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index c0041cb99..34e7fc487 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-27  Jean Brefort  <jean brefort normalesup org>
+
+       * xlsx-read-drawing.c (xlsx_draw_clientdata): don't set the print flag if
+       we do not import the object.
+
 2020-05-09  Morten Welinder <terra gnome org>
 
        * Release 1.12.47
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index c033ae809..957a4098d 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -523,6 +523,9 @@ xlsx_draw_clientdata (GsfXMLIn *xin, xmlChar const **attrs)
        XLSXReadState *state = (XLSXReadState *)xin->user_state;
        gboolean print = TRUE;
 
+       if (state->so == NULL) /* happens if gnumeric does not support the object */
+               return;
+
        for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
                if (attr_bool (xin, attrs, "fPrintsWithSheet", &print)) {
                        /* Nothing more */
diff --git a/src/sheet-object.c b/src/sheet-object.c
index a73e41fd9..a5dc5aa93 100644
--- a/src/sheet-object.c
+++ b/src/sheet-object.c
@@ -105,6 +105,8 @@ static GQuark       sov_container_quark;
 void
 sheet_object_set_print_flag (SheetObject *so, gboolean *print)
 {
+       g_return_if_fail (GNM_IS_SO (so));
+       
        if (*print)
                so->flags |= SHEET_OBJECT_PRINT;
        else


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