On 01/20/2018 11:48 PM, Tobias T wrote:
> If I remember correctly (it has been a while) ZIP64 output can only work if
> a size has been specified when using PutNextEntry(). Which means the
> size has to
> be known in advance.
Hi,
I'm having a hard time debugging this because of the large file sizes
and absolutely no experience with the ZIP file format. So I can just
report some of the observations I made in the hope they will give
someone some hints on what is going on.
- I did specify a size when using PutNextEntry(), and this triggers
ZIP64 when the size exceeds 0xffffffff. Nevertheless, I still get errors
when reading back the created files.
Side note: debugging makes me think that it is not necessary to specify
the exact file size to trigger ZIP64 as long as the size is big enough
because both "size" and "compressed_size" seem to be recalculated in
CloseEntry() called from ~wxZipOutputStream(). If that is true, it would
facilitate the usage of ZIP64 (and could possibly be made a boolean choice)
However, there are two different scenarios, both resulting in errors,
but interestingly in different ones:
- the data to zip is > 4GB, but the zipped archive is < 4GB:
in this case wxZipInputStream reports "reading zip stream (entry %s):
bad length"; extracting the file with 7z reports "Headers Error" and
"CRC failed"
Interestingly the extracted file is complete and correct despite the
errors reported.
- both the data to zip and the zipped archive are > 4GB:
in this case, wx reports "Can't read inflate stream: unexpected EOF in
underlying stream"; 7z reports "Headers Errors; Unconfirmed start of
archive; Warnings: There are some data after the end of the payload
data" and "CRC failed"
The extracted file only contains a portion of the original file and is
incorrect.
So it seems that all data gets written (also indicated by the file sizes
of the zip archives), but that there are some problems with the header
entries / offsets. Checks for both cases are in many places and I cannot
tell where it is failing, unfortunately.
Regards,
Volker