stachenov / quazip

Qt/C++ wrapper over minizip
Other
565 stars 235 forks source link

Comment is not read in ZIP64 archive #158

Open jardik opened 1 year ago

jardik commented 1 year ago

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 (https://github.com/stachenov/quazip/blob/98bcb48dcbc709427a930687142bbcd27d5e8594/quazip/unzip.c#L687). 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:

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