Read comp_size, decomp_size and local_header_ofs for zip64 if extra fields exist#324
Read comp_size, decomp_size and local_header_ofs for zip64 if extra fields exist#324larryliu0820 wants to merge 2 commits into
Conversation
As titled. For a zip64 archive file, `comp_size` and `decomp_size` are not stored in `p + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS`, instead they are being stored in `pExtra_data`. Here we need to read `uint64` for `comp_size` and `decomp_size`. Good that they are already of that type.
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
…d patch for zip64" Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
…d patch for zip64" Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D65586230](https://our.internmc.facebook.com/intern/diff/D65586230) [ghstack-poisoned]
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D65586230](https://our.internmc.facebook.com/intern/diff/D65586230) [ghstack-poisoned]
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 4501669 Pull Request resolved: #139985
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Differential Revision: D65586230
Summary: Pull Request resolved: #140041 Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Differential Revision: D65586230
Summary: Pull Request resolved: #140041 Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Differential Revision: D65586230
Summary: Pull Request resolved: #140041 Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Reviewed By: mikaylagawarecki, angelayi Differential Revision: D65586230
Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * #79636 patches internal BUCK and bazel build * #138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Differential Revision: D65586230 Pull Request resolved: #140041 Approved by: https://github.com/mikaylagawarecki
…140041) Summary: Bump miniz version from 2.1.0 to 3.0.2 and apply these patches: * pytorch#79636 patches internal BUCK and bazel build * pytorch#138959 adds `bool compute_crc32` argument * miniz PR: richgel999/miniz#324 to support zip64 Anyone bumping miniz version again, please apply these patches as well. Test Plan: Rely on unit test Imported from OSS Differential Revision: D65586230 Pull Request resolved: pytorch#140041 Approved by: https://github.com/mikaylagawarecki
|
Why do you need the correct zip64 values at that location? As far as I can see at this point they are just used for some checks and deciding if it is a zip64 file or not. |
While I'm not sure of @larryliu0820's motivations (maybe just to make sure that the check fails correctly when the zip64 fields are corrupt) I've run into an issue which would be fixed by this (it might also be related to #301). When zip64 attributes are used for archive sizes of less than 2^32 bytes there is a false positive with the following check, since Lines 935 to 939 in c883286 This only occurs when zip64 fields are used with an archive size of less than about 2^32 bytes, since the sanity check will always succeed if the UINT32_MAX flag value indicating the true value is in an extended field is more than a little smaller than the archive size. I ran into this with cpython's zipfile implementation, which uses zip64 for values larger than 2^31-1, so zip archives between 2-4GB produced by it will exhibit this problem (though I think they are valid according to the spec since they are marked as zip64 archives, even though it's unnecessary to use the separate field to store the offset if it's smaller than 2^32-1). I was going to submit a fix (59ca512), but this PR is a better solution (on the other hand, this PR would change the meaning of the |
As titled. For a zip64 archive file,
comp_size,decomp_sizeandlocal_header_ofsare not stored inp + MZ_ZIP_CDH_COMPRESSED_SIZE_OFS, instead they are being stored inpExtra_data.Here we need to read
uint64forcomp_size,decomp_sizeandlocal_header_ofs. Good that they are already of that type.Reference: https://en.wikipedia.org/wiki/ZIP_(file_format)#ZIP64