From: Tim Kientzle Date: Fri, 20 Dec 2013 04:55:10 +0000 (-0800) Subject: Merge branch 'encryption_detection' of github.com:kwk/libarchive into kwk-encryption_... X-Git-Tag: v3.1.900a~347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a90710e0d3c786cf4f3af2457a815db6c9b5a5a;p=thirdparty%2Flibarchive.git Merge branch 'encryption_detection' of github.com:kwk/libarchive into kwk-encryption_detection Conflicts: libarchive/archive_read_support_format_zip.c --- 7a90710e0d3c786cf4f3af2457a815db6c9b5a5a diff --cc libarchive/archive_read_support_format_zip.c index 06334e80c,db2c31f44..5c25281f2 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@@ -311,17 -363,19 +363,19 @@@ archive_read_format_zip_seekable_bid(st /* Since we've already done the hard work of finding the end of central directory record, let's save the important information. */ - zip->central_directory_entries = archive_le16dec(p + 10); + zip->central_directory_entries_on_this_disk = archive_le16dec(p + 8); + zip->central_directory_entries_total = archive_le16dec(p + 10); zip->central_directory_size = archive_le32dec(p + 12); zip->central_directory_offset = archive_le32dec(p + 16); - zip->end_of_central_directory_offset = filesize; - + zip->end_of_central_directory_offset = end_of_central_directory_offset; + /* Just one volume, so central dir must all be on this volume. */ - if (zip->central_directory_entries != archive_le16dec(p + 8)) + if (zip->central_directory_entries_total != zip->central_directory_entries_on_this_disk) { return 0; + } - /* Central directory can't extend beyond end of this file. */ + /* Central directory can't extend beyond start of EOCD record. */ if (zip->central_directory_offset + - (int64_t)zip->central_directory_size > filesize) + (int64_t)zip->central_directory_size > end_of_central_directory_offset) return 0; /* This is just a tiny bit higher than the maximum returned by diff --cc libarchive/test/CMakeLists.txt index 90da7552e,dc36cc897..8c10c906f --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@@ -141,10 -147,11 +147,13 @@@ IF(ENABLE_TEST test_read_format_xar.c test_read_format_zip.c test_read_format_zip_comment_stored.c + test_read_format_zip_encryption_data.c + test_read_format_zip_encryption_partially.c + test_read_format_zip_encryption_header.c test_read_format_zip_filename.c test_read_format_zip_mac_metadata.c + test_read_format_zip_nofiletype.c + test_read_format_zip_padded.c test_read_format_zip_sfx.c test_read_large.c test_read_pax_truncated.c