-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Describe the bug
In 4065f05#diff-f5613ff66dd29a0567e4173ff7c04ed28b08eb7384040946dd410698700b87eeR1130-R1132 a check was introduced which prevents file data from starting after the central header directory.
This was extended in https://github.com/zip-rs/zip2/pull/247/files#diff-f5613ff66dd29a0567e4173ff7c04ed28b08eb7384040946dd410698700b87eeR1065-R1069 to also check the file header.
While this may be desirable to catch bad entries in some cases, this is not in accordance with the zip spec (I think?), and in particular the firefox omnijar layout places the central header directory at the start of the file (so all file headers and contents reside after it). You can take a look at the format by unpacking a firefox tarball or looking in a firefox installation for the omni.ja
file. There's also a description here (though it appears that the diagrams have succumbed to bitrot).
If this behavior is essential or particularly useful in the general case, it'd be great if it could be configurable, or maybe those checks shouldn't be done if ArchiveOffset::Known
is used.
To Reproduce
- Modify the example
extract
program to open the archive withzip::ZipArchive::with_config(zip::read::Config { archive_offset: zip::read::ArchiveOffset::Known(0) }, file)
- Run the
extract
example on the Firefoxomni.ja
file (described previously).
Expected behavior
Extraction succeeds.