[gnumeric] xls: fix crash reading a strange header/footer record.



commit b0dbfbb8b7dcd1ccc9bd68bb7a8c631c1bb15ddb
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 16 13:47:12 2014 -0400

    xls: fix crash reading a strange header/footer record.

 NEWS                          |    1 +
 plugins/excel/ChangeLog       |    5 +++++
 plugins/excel/ms-excel-util.c |    6 +++++-
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index ecb8f5c..20c5c75 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Morten:
        * Fix minor conditional format GUI issues.
        * Plug leak.
        * Fix font dialog problem with underline.
+       * Fix crash reading strane xls file.  [Redhat #1076912]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.12
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 71414d5..c077ad9 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-16  Morten Welinder  <terra gnome org>
+
+       * ms-excel-util.c (xls_header_footer_import): Treat a NULL string
+       as an empty string.  Redhat #1076912.
+
 2014-03-15  Morten Welinder  <terra gnome org>
 
        * ms-excel-write.c (cb_write_condition): Store superscript and
diff --git a/plugins/excel/ms-excel-util.c b/plugins/excel/ms-excel-util.c
index 79d6e50..4bb9160 100644
--- a/plugins/excel/ms-excel-util.c
+++ b/plugins/excel/ms-excel-util.c
@@ -750,12 +750,16 @@ void
 xls_header_footer_import (PrintHF *hf, const char *txt)
 {
        char section = 'L';
-       GString *accum = g_string_new (NULL);
+       GString *accum;
 
        g_free (hf->left_format); hf->left_format = g_strdup ("");
        g_free (hf->middle_format); hf->middle_format = g_strdup ("");
        g_free (hf->right_format); hf->right_format = g_strdup ("");
 
+       if (!txt)
+               return;
+
+       accum = g_string_new (NULL);
        while (1) {
                if (txt[0] == 0 ||
                    (txt[0] == '&' && strchr ("LCR", txt[1]))) {


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