[gnumeric] xls: fix problem with strings outside codepage



commit f7a425eb8402f7a8dd9b8225d82f76de86104a22
Author: Morten Welinder <terra gnome org>
Date:   Tue Jun 16 08:40:25 2015 -0400

    xls: fix problem with strings outside codepage
    
    When we use the conversion fallback, we need to ensure the same multi-NUL
    termination as the regular case.

 NEWS                           |    1 +
 plugins/excel/ChangeLog        |    5 +++++
 plugins/excel/ms-excel-write.c |    4 ++++
 3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 11d04f9..755a3fc 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Morten:
        * Fix xls saving of marker style.  [#749185]
        * Make compilation with clang work again.  [#749138]
        * Fix xlsx problem with import of header/footer.  [#750853]
+       * Fix xls save problem with characters outside codepage.  [#750856]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.22
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index bec2c14..da84760 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-16  Morten Welinder  <terra gnome org>
+
+       * ms-excel-write.c (excel_convert_string): Ensure multi-NUL
+       terminator.  Fixes #750856.
+
 2015-06-15  Morten Welinder  <terra gnome org>
 
        * xlsx-read.c (xlsx_comments_dtd): Fix dtd by not including
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index c83ea03..64c81be 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -343,6 +343,10 @@ excel_convert_string (BiffPut *bp, const char *txt, size_t *out_bytes)
        }
 
        *out_bytes = accum->len;
+
+       /* Ensure termination with 4+ NULs.  */
+       g_string_append_len (accum, "\0\0\0\0", 4);
+
        return g_string_free (accum, FALSE);
 }
 


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