[libgsf] zip: fix error handling.



commit fced2118398b33cd01552a98008639c6276aa5bf
Author: Morten Welinder <terra gnome org>
Date:   Wed Jan 13 09:07:20 2016 -0500

    zip: fix error handling.
    
    Completely abort the read instead of returning the partially-read buffer.

 ChangeLog            |    5 +++++
 NEWS                 |    1 +
 gsf/gsf-infile-zip.c |    2 +-
 3 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 58e47d8..fda8cf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-13  Morten Welinder  <terra gnome org>
+
+       * gsf/gsf-infile-zip.c (gsf_infile_zip_read): Improve error
+       handling.  Fixes #760543.
+
 2016-01-01  Morten Welinder  <terra gnome org>
 
        * gsf/gsf-msole-utils.c (msole_metadata_write_section): Handle the
diff --git a/NEWS b/NEWS
index ef1c65e..ea1e45b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ libgsf 1.14.35
 
 Morten:
        * Fix OLE2 property writing issue.  [#760047]
+       * Improve handling of broken zip files.  [#760543]
 
 --------------------------------------------------------------------------
 libgsf 1.14.34
diff --git a/gsf/gsf-infile-zip.c b/gsf/gsf-infile-zip.c
index 84cbbe9..41cbd7c 100644
--- a/gsf/gsf-infile-zip.c
+++ b/gsf/gsf-infile-zip.c
@@ -651,7 +651,7 @@ gsf_infile_zip_read (GsfInput *input, size_t num_bytes, guint8 *buffer)
                        else if (err == Z_OK)
                                zip->restlen -= (zip->stream->total_out - startlen);
                        else
-                               break;
+                               return NULL;  /* Error, probably corrupted */
 
                } while (zip->restlen && zip->stream->avail_out);
 


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