Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support zip files where EOCD's offset to central dir is -1
When zip files contain more than 2**16 entries, the regular EOCD is not sufficient to describe the number of files in the archive, and a Zip64 EOCD needs to be written. When a Zip64 EOCD is written, some zip libraries write -1 for many of the fields in the regular EOCD, including the offset to central dir: From APPNOTE.TXT §4.4.1.4 If one of the fields in the end of central directory record is too small to hold required data, the field SHOULD be set to -1 (0xFFFF or 0xFFFFFFFF) and the ZIP64 format record SHOULD be created. Previously FileMap assumed that the regular EOCD contained a valid offset to central dir field. This broke recently when an experimental Android SDK had more than 64k entries in the zip file and -1 for the offset to the central dir. Add support for reading the offset to the central from the Zip64 EOCD. Also add a test case that generates a problematic zip file. PiperOrigin-RevId: 492538213
- Loading branch information
Showing
2 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters