[libgsf] Zip: catch overflow of csize when zip64==FALSE.



commit 54a527078c8897bd2a4b1026388058ed39ec57c9
Author: Morten Welinder <terra gnome org>
Date:   Sun Nov 30 19:14:09 2014 -0500

    Zip: catch overflow of csize when zip64==FALSE.

 ChangeLog             |    1 +
 gsf/gsf-outfile-zip.c |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 22035ca..d0167dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
        (zip_header_write): If we write a real zip64 entry, mark the
        dirent as being zip64.
        (zip_close_root): If any dirent is zip64, the archive is.
+       (zip_output_block): Catch overflow of csize.
 
 2014-11-29  Morten Welinder  <terra gnome org>
 
diff --git a/gsf/gsf-outfile-zip.c b/gsf/gsf-outfile-zip.c
index 56bd7e9..2c95d09 100644
--- a/gsf/gsf-outfile-zip.c
+++ b/gsf/gsf-outfile-zip.c
@@ -627,6 +627,9 @@ zip_output_block (GsfOutfileZip *zip)
                return FALSE;
        }
        dirent->csize += num_bytes;
+       if (dirent->zip64 == FALSE && dirent->csize >= G_MAXUINT32)
+               return FALSE;
+
        zip->stream->next_out  = zip->buf;
        zip->stream->avail_out = zip->buf_size;
 


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