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

Comment is not read in ZIP64 archive #158

Open
jardik opened this issue Oct 29, 2022 · 0 comments
Open

Comment is not read in ZIP64 archive #158

jardik opened this issue Oct 29, 2022 · 0 comments

Comments

@jardik
Copy link

jardik commented Oct 29, 2022

This is an issue of original minizip code (unzip.c), but I believe it could be fixed in QuaZip, because it is customized anyway. Issue is that in unzOpenInternal function "end of zip64 cemtral directory record" is looked for as a first thing (unz64local_SearchCentralDir64) and, if it fails, only after that end of central directory record is looked for. If zip64 end of central directory record is found, standard zip end of central directory record is ignored and comment length is set to 0 (

us.gi.size_comment = 0;
). Due to this, the comment is never found/loaded from the archive. It also allows for loading broken/incorrect archives - archive must always contain end of central directory record (see official APPNOTE.txt, 4.3.1), and this is not checked for ZIP64 archive.

I believe correct ordering is:

  • Locate end of central directory record (and read comment from there).
  • Only after that record is found, look before the record, to see if it contains "zip64 end of central directory locator" (this has fixed size and it must immediately precede the end of central directory record).
  • After the locator is found, use it to find zip64 end of central directory record.

This way, the comment from end of central directory record can be loaded for ZIP64 archive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant