-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot parse file header with uncompressed size, compressed size, or local file header offset of 0xffffffff, if not in Zip64 format #109
Comments
Thanks again for the thorough writeup! This is fixed in yauzl 3.1.2.
These were excellent test cases! 💯 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue is a companion to #108, but affects a different part of the parser. yauzl 2.10.0 cannot parse zip files whose
uncompressedSize
,compressedSize
, orrelativeOffsetOfLocalHeader
is 0xffffffff, unless the file is in Zip64 format. The relevant code is here:yauzl/index.js
Lines 333 to 337 in 02a5ca6
When yauzl sees a 0xffffffff value in one of these fields, it assumes that the zip file must be in Zip64 format. But APPNOTE.TXT 4.4.8, 4.4.9, and 4.4.16 say (emphasis mine):
The way I interpret this statement, the logic should not be what yauzl does now:
but should instead be:
This issue is basically the same as golang/go#31692. The difference is that Go archive/zip has a special-case workaround for the compressed size, but not the other two fields.
The test cases which follow are able to be parsed by Info-ZIP UnZip (
unzip
) and Python zipfile (python3 -m zipfile -e
). Go archive/zip can parse the uncompressed size test but not the other two.Uncompressed size test case
ffffffff-uncompressedSize.zip.gz (remove 1 layer of gzip before testing)
zipinfo -v
says:yauzl does not parse it:
Compressed size test case
It's difficult to construct a test case that has
compressedSize
= 0xffffffff anduncompressedSize
< 0xffffffff. It could plausibly happen if the compressor implements "store" mode not ascompressionMethod
0, but ascompressionMethod
8 (DEFLATE) and non-compressed blocks, which increase the compressed size slightly. The example here instead hascompressedSize
=uncompressedSize
= 0xffffffff.ffffffff-compressedSize.zip.gz.gz (remove 2 layers of gzip before testing)
zipinfo -v
says:yauzl does not parse it:
Local file header offset test case
ffffffff-relativeOffsetOfLocalHeader.zip.gz.gz (remove 2 layers of gzip before testing)
zipinfo -v
says:yauzl does not parse it:
The text was updated successfully, but these errors were encountered: