-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Zip archives not starting at zero offset
Zip archives are usually read from the back to the front, making it possible to append them to other files (e.g. executables) in order to provide some kind of embedded filesystem. We can actually extract the start of the archive by looking at the central directory offset, by comparing the specified and the actual file offset. The Zip64 format adds another challenge as the EOCD locator specifies the offset to the EOCD starting from the beginning of the archive. Such relative offset cannot be directly used for archives not starting at position zero, hence the addition of another step that tries to locate the 64bit EOCD right before the EOCD locator. The added overhead is pretty small (and could be made smaller by reading both the presumed EOCD and EOCD locator at once) and works pretty well for 90% of the archives I've tested it with, if that heuristic fails the old behaviour is preserved.
- Loading branch information
Showing
1 changed file
with
65 additions
and
12 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