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

Bug#769290: libarchive: Zip file extract produces zero size files



Source: libarchive
Version: 3.1.2-9
Severity: important
Tags: patch

Hi,

The current libarchive fails to extract files from a zip file generated in Mac 
systems, such as:
http://quran.ksu.edu.sa/ayat/download/programs/Ayat-v1.3.2_linux.zip

The upstream fix for this issue is:
https://github.com/libarchive/libarchive/commit/e234932de2474c4f99787e1741f6729c5098fd64

I'm not sure if it's worth considering this issue rc or not, but it would be 
nice it the fix enters into jessie. At least the ark (which uses libarchive to 
handle zip files) users would prefer that.

I'm attaching a preliminar debdiff for this change.

Happy hacking,

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff -Nru libarchive-3.1.2/debian/changelog libarchive-3.1.2/debian/changelog
--- libarchive-3.1.2/debian/changelog	2014-08-17 10:45:46.000000000 +0200
+++ libarchive-3.1.2/debian/changelog	2014-11-12 13:53:51.000000000 +0100
@@ -1,3 +1,10 @@
+libarchive (3.1.2-9.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * New patch: upstream_do_not_overwrite_file_size
+
+ -- Maximiliano Curia <maxy@debian.org>  Wed, 12 Nov 2014 13:53:51 +0100
+
 libarchive (3.1.2-9) unstable; urgency=medium
 
   [ Andreas Henriksson ]
diff -Nru libarchive-3.1.2/debian/patches/series libarchive-3.1.2/debian/patches/series
--- libarchive-3.1.2/debian/patches/series	2014-08-08 22:55:38.000000000 +0200
+++ libarchive-3.1.2/debian/patches/series	2014-11-12 13:54:02.000000000 +0100
@@ -6,3 +6,4 @@
 Allow-the-option-to-use-no-2nd-stage-compression-wit.patch
 Fix-test_archive_write_add_filter_by_name_lrzip-test.patch
 fix-CVE-2013-0211.patch
+upstream_do_not_overwrite_file_size
diff -Nru libarchive-3.1.2/debian/patches/upstream_do_not_overwrite_file_size libarchive-3.1.2/debian/patches/upstream_do_not_overwrite_file_size
--- libarchive-3.1.2/debian/patches/upstream_do_not_overwrite_file_size	1970-01-01 01:00:00.000000000 +0100
+++ libarchive-3.1.2/debian/patches/upstream_do_not_overwrite_file_size	2014-11-12 13:54:01.000000000 +0100
@@ -0,0 +1,26 @@
+commit e234932de2474c4f99787e1741f6729c5098fd64
+Author: Jung-uk Kim <jkim@FreeBSD.org>
+Date:   Mon Apr 1 17:02:18 2013 -0400
+
+    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.
+
+diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c
+index 450a6f7..c9fae7f 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;

Reply to: