From e234932de2474c4f99787e1741f6729c5098fd64 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Mon, 1 Apr 2013 17:02:18 -0400 Subject: [PATCH] Do not overwrite file size if the local file header has valid file size. This allows us to extract index.xml from Apple iWork '09 format files. --- libarchive/archive_read_support_format_zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 450a6f7da..c9fae7f24 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -1619,10 +1619,12 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) switch (headerid) { case 0x0001: /* Zip64 extended information extra field. */ - if (datasize >= 8) + if (datasize >= 8 && + zip_entry->uncompressed_size == 0xffffffff) zip_entry->uncompressed_size = archive_le64dec(p + offset); - if (datasize >= 16) + if (datasize >= 16 && + zip_entry->compressed_size == 0xffffffff) zip_entry->compressed_size = archive_le64dec(p + offset + 8); break; -- 2.47.2