From: Tim Kientzle Date: Wed, 25 Dec 2013 01:25:55 +0000 (-0800) Subject: Merge recent changes from libarchive master repository. X-Git-Tag: v3.1.900a~327^2~42^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=155d58656ab60637dbc654ac6e8d74a4b4160e6f;p=thirdparty%2Flibarchive.git Merge recent changes from libarchive master repository. --- 155d58656ab60637dbc654ac6e8d74a4b4160e6f diff --cc libarchive/archive_read_support_format_zip.c index bd01caa5c,bd4ccdec8..c83cfb2a4 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@@ -1334,24 -1428,20 +1447,24 @@@ zip_read_data_none(struct archive_read "Truncated ZIP file data"); return (ARCHIVE_FATAL); } - /* Check for a complete PK\007\010 signature. */ + /* Check for a complete PK\007\010 signature, followed + * by the correct 4-byte CRC. */ p = buff; - if (p[0] == 'P' && p[1] == 'K' + if (p[0] == 'P' && p[1] == 'K' && p[2] == '\007' && p[3] == '\010' - && archive_le32dec(p + 4) == zip->entry_crc32 - && archive_le32dec(p + 8) == - zip->entry_compressed_bytes_read - && archive_le32dec(p + 12) == - zip->entry_uncompressed_bytes_read) { - zip->entry->crc32 = archive_le32dec(p + 4); - zip->entry->compressed_size = archive_le32dec(p + 8); - zip->entry->uncompressed_size = archive_le32dec(p + 12); + && archive_le32dec(p + 4) == zip->entry_crc32) { + if (zip->entry->have_zip64) { + zip->entry->crc32 = archive_le32dec(p + 4); + zip->entry->compressed_size = archive_le64dec(p + 8); + zip->entry->uncompressed_size = archive_le64dec(p + 16); + zip->unconsumed = 24; + } else { + zip->entry->crc32 = archive_le32dec(p + 4); + zip->entry->compressed_size = archive_le32dec(p + 8); + zip->entry->uncompressed_size = archive_le32dec(p + 12); + zip->unconsumed = 16; + } zip->end_of_entry = 1; - zip->unconsumed = 16; return (ARCHIVE_OK); } /* If not at EOF, ensure we consume at least one byte. */