[libgsf] msole: fix problems with bogus metadata.



commit 1b9159c2f88e37cb4868132ea7b540dfd7f9cd62
Author: Morten Welinder <terra gnome org>
Date:   Thu Jul 11 09:53:47 2013 -0400

    msole: fix problems with bogus metadata.
    
    (Where problems == crash.)

 ChangeLog             |    5 +++++
 NEWS                  |    3 +++
 gsf/gsf-msole-utils.c |    5 +++++
 3 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b10e222..9e4c82d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-11  Morten Welinder  <terra gnome org>
+
+       * gsf/gsf-msole-utils.c (msole_metadata_write_string): Protect
+       against strings that cannot be converted.  See bug #703952.
+
 2013-06-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * gsf/gsf-infile-msole.c (gsf_infile_msole_read): use the
diff --git a/NEWS b/NEWS
index 3080495..345ab86 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ libgsf 1.14.28
 Andreas:
        * Fix conversion specifiers. [#703064]
 
+Morten:
+       * Fix problem with bogus metadata.  [#703952]
+
 --------------------------------------------------------------------------
 libgsf 1.14.27
 
diff --git a/gsf/gsf-msole-utils.c b/gsf/gsf-msole-utils.c
index c95e8a3..e74c8bb 100644
--- a/gsf/gsf-msole-utils.c
+++ b/gsf/gsf-msole-utils.c
@@ -1409,6 +1409,11 @@ msole_metadata_write_string (WritePropState *state, const char *txt)
        len = strlen (txt);
        ctxt = g_convert_with_iconv (txt, len, state->iconv_handle,
                                     NULL, &bytes_written, NULL);
+       if (!ctxt) {
+               /* See bug #703952 */
+               g_warning ("Failed to write metadata string");
+               bytes_written = 0;
+       }
 
        GSF_LE_SET_GUINT32 (buf, len + 1);
        res = gsf_output_write (state->out, 4, buf);


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