Skip to content
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

Support Zip archives not starting at zero offset #309

Merged
merged 1 commit into from
Jun 9, 2024

Commits on Jun 1, 2024

  1. 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.
    LemonBoy committed Jun 1, 2024
    Configuration menu
    Copy the full SHA
    43bc679 View commit details
    Browse the repository at this point in the history