[libgsf] zip: fix reading extended fields for zip64.



commit 0e6958a30d5d93189354bf1199a8514077cafac0
Author: Morten Welinder <terra gnome org>
Date:   Sun Nov 23 11:39:17 2014 -0500

    zip: fix reading extended fields for zip64.

 ChangeLog            |    5 ++++-
 gsf/gsf-infile-zip.c |   16 ++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8b07d36..b955088 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-11-23  Morten Welinder  <terra gnome org>
 
+       * gsf/gsf-infile-zip.c (zip_dirent_new_in): Fix reading of
+       extended field.  csize and usize are swapped in there.
+
        * gsf/gsf-outfile-zip.c (zip_dirent_write): Fix file mode.
 
 2014-11-22  Morten Welinder  <terra gnome org>
@@ -18,7 +21,7 @@
 
        * gsf/gsf-infile-zip.c (zip_read_dirents): Handle zip64 format for
        archives with 65535 or more members.
-       (ZipInfo): Larger fields; user GPtrArray for speed.  All users
+       (ZipInfo): Larger fields; use GPtrArray for speed.  All users
        changed.
        (zip_find_trailer): Fix endianess issue.
        (gsf_infile_zip_read): Fix 64-bit issue.
diff --git a/gsf/gsf-infile-zip.c b/gsf/gsf-infile-zip.c
index a177e67..edb5d31 100644
--- a/gsf/gsf-infile-zip.c
+++ b/gsf/gsf-infile-zip.c
@@ -282,25 +282,25 @@ zip_dirent_new_in (GsfInfileZip *zip, gsf_off_t *offset)
        dostime =       GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_DOSTIME);
        crc32 =         GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_CRC32);
        csize =         GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_CSIZE);
-       if (csize == 0xffffffffu && elen >= 8) {
-               csize = GSF_LE_GET_GUINT64 (extra);
-               extra += 8;
-               elen -= 8;
-       }
        usize =         GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_USIZE);
+       off =           GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_OFFSET);
+       disk_start =    GSF_LE_GET_GUINT16 (data + ZIP_DIRENT_DISKSTART);
+
        if (usize == 0xffffffffu && elen >= 8) {
                usize = GSF_LE_GET_GUINT64 (extra);
                extra += 8;
                elen -= 8;
        }
-       off =           GSF_LE_GET_GUINT32 (data + ZIP_DIRENT_OFFSET);
+       if (csize == 0xffffffffu && elen >= 8) {
+               csize = GSF_LE_GET_GUINT64 (extra);
+               extra += 8;
+               elen -= 8;
+       }
        if (off == 0xffffffffu && elen >= 8) {
                off = GSF_LE_GET_GUINT64 (extra);
                extra += 8;
                elen -= 8;
        }
-
-       disk_start =    GSF_LE_GET_GUINT16 (data + ZIP_DIRENT_DISKSTART);
        if (disk_start == 0xffffu && elen >= 4) {
                disk_start = GSF_LE_GET_GUINT32 (extra);
                extra += 4;


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