Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic when a non-zip64 local header is written after 0xFFFFFFFF
The zip spec allows non-zip64 local headers to be written at offset >=2^32 as long as the corresponding central directory entry has a zip64 extra field for the local header offset. However, when writing a non-zip64 small file after the 2^32 boundary, `local_header_size()` would return a zip64 size while writing a non-zip64 local header to disk. This would cause `self.stats.start` to get out of sync, leading to a panic in `finish_file()` when doing a checked subtraction for `self.compressed_size`. This would only manifest when performing streaming writes. This commit fixes the problem by updating `local_header_size()` to use a new `zip64_sizes()` method that only considers the compressed and uncompressed size fields since only those two matter for determining the size of a local header. Signed-off-by: Andrew Gunnerson <[email protected]>
- Loading branch information