[libgsf] Zip: if the central directory entry uses zip64, require 4.5 for extraction.



commit 745c2882d76b619587bda75359222564c8442512
Author: Morten Welinder <terra gnome org>
Date:   Mon Dec 1 13:26:02 2014 -0500

    Zip: if the central directory entry uses zip64, require 4.5 for extraction.
    
    It's unclear whether this is needed, but it should not hurt.  It only
    makes a difference for a small file stored beyond offset 4G in the
    archive.  That cannot be common.

 ChangeLog             |    3 +++
 gsf/gsf-outfile-zip.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fab27b1..34a06ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
        * gsf/gsf-outfile-zip.c (zip_dirent_write): Handle the case of
        small file beyond offset 4G.  The header record won't be zip64,
        but the dirent needs to.
+       (zip_dirent_write): Mark this entry as needing 4.5 to extract if
+       the central directory entry uses zip64, even if the local header
+       does not.
 
 2014-11-30  Morten Welinder  <terra gnome org>
 
diff --git a/gsf/gsf-outfile-zip.c b/gsf/gsf-outfile-zip.c
index 5139f82..ecfe7d8 100644
--- a/gsf/gsf-outfile-zip.c
+++ b/gsf/gsf-outfile-zip.c
@@ -161,10 +161,10 @@ zip_dirent_write (GsfOutfileZip *zip, const GsfZipDirent *dirent)
        guint8 buf[ZIP_DIRENT_SIZE];
        int nlen = strlen (dirent->name);
        gboolean ret;
-       const guint8 extract = dirent->zip64 ? 45 : 23;
        GString *extras = g_string_sized_new (ZIP_DIRENT_SIZE + nlen + 100);
        gboolean offset_in_zip64 = dirent->offset >= G_MAXUINT32;
        gboolean zip64_here = (dirent->zip64 || offset_in_zip64);
+       const guint8 extract = zip64_here ? 45 : 23;  /* Unsure if dirent->zip64 is enough */
 
        if (zip64_here) {
                char tmp[8];


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