summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@acm.org>2018-12-15 12:23:59 -0800
committerTim Kientzle <kientzle@acm.org>2018-12-15 12:23:59 -0800
commit6e2ffe14abb4901e1945895d63e68d65f4694780 (patch)
tree250090979cd23c08709a3500df19f96bcf0cf79c /Makefile.am
parentcef97307a3f681fcbb2cc02db6df3619a3f8b69c (diff)
downloadlibarchive-6e2ffe14abb4901e1945895d63e68d65f4694780.tar.gz
Issue #1055: Ignore padding in Zip extra field data
PKWare's APPNOTE.TXT simply documents the extra field as a concatenation of <header><data> objects. It does not explicitly allow nor prohibit additional padding. Libarchive originally treated any extraneous data in the extra field as an indication of corruption and issued an error. However, some Zip writers do appear to include additional zero bytes in the extra field and expect them to be ignored. This works if: * We consider a field type of 0000 to be a padding field. * In particular, 0000 0000 is then a valid field with type zero and zero bytes of data. * If there are fewer than 4 bytes left at the end of the extra data (too few to be a valid extra field object), ignore it. With the above conventions, zero padding can occur anywhere in the extra field as long as the padding occurs in a multiple of four bytes. Any number of bytes can occur at the end: groups of four bytes will be skipped as valid empty fields; any final group of less than four bytes will be simply ignored. The test exercises all of the above options; the extra field data for the file in this archive has: * Four zero bytes at the beginning * A valid UX field * A pad field of type zero with a non-zero length * An additional three final bytes By verifying that the UX data was read correctly and that there were no errors, we can be confident that all of the padding here was handled correctly.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am2
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 80a4e17d..ea6b2dc0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -512,6 +512,7 @@ libarchive_test_SOURCES= \
libarchive/test/test_read_format_zip_encryption_data.c \
libarchive/test/test_read_format_zip_encryption_partially.c \
libarchive/test/test_read_format_zip_encryption_header.c \
+ libarchive/test/test_read_format_zip_extra_padding.c \
libarchive/test/test_read_format_zip_filename.c \
libarchive/test/test_read_format_zip_high_compression.c \
libarchive/test/test_read_format_zip_jar.c \
@@ -839,6 +840,7 @@ libarchive_test_EXTRA_DIST=\
libarchive/test/test_read_format_zip_encryption_data.zip.uu \
libarchive/test/test_read_format_zip_encryption_header.zip.uu \
libarchive/test/test_read_format_zip_encryption_partially.zip.uu \
+ libarchive/test/test_read_format_zip_extra_padding.zip.uu \
libarchive/test/test_read_format_zip_filename_cp866.zip.uu \
libarchive/test/test_read_format_zip_filename_cp932.zip.uu \
libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \