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

Set version in ZIP local header to ZIP64 when file offset is >4GB #102053

Merged
merged 9 commits into from
May 31, 2024

Conversation

carlossanlop
Copy link
Member

Original PR by @karakasa #94970

Fixes #94899 (Analysis in the comments. This PR fixes some compatibility issues of ZIP64 archives with certain decompressors (such as .NET Framework).

The spec is unclear whether the versionNeeded should be same in the CD and LH, and decompressors like 7-Zip & Windows don't complain about the discrepancy. Nevertheless I found 7-Zip set the LH to version ZIP64 under such circumstance.

The test is put in the outer loop because it will create a large 5GB file.

The current code changes have already been reviewed in the old PR. The only thing left to do is adding a test for System.IO.Packaging to confirm the original reported issue is fixed.

cc @llali

@carlossanlop carlossanlop merged commit 0cc0791 into dotnet:main May 31, 2024
83 checks passed
@carlossanlop carlossanlop deleted the zip64offset branch May 31, 2024 20:42
@carlossanlop
Copy link
Member Author

/backport to release/8.0-staging

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/9324124718

Copy link
Contributor

@carlossanlop backporting to release/8.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Check LH offset when writing LH. Fix #94899
Applying: added test
Applying: added comment
Applying: move conditions into methods
error: sha1 information is lacking or useless (src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0004 move conditions into methods
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

@carlossanlop an error occurred while backporting to release/8.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@carlossanlop carlossanlop restored the zip64offset branch June 3, 2024 18:14
carlossanlop added a commit to carlossanlop/runtime that referenced this pull request Jun 3, 2024
…tnet#102053)

* ZipArchiveEntry didn't set ZIP64 in local headers for small files if their offset are > 4GB.
* Added System.IO.Compression and System.IO.Packaging tests.

---------

Co-authored-by: Gan Keyu <gankeyu@hotmail.com>
@carlossanlop carlossanlop deleted the zip64offset branch June 5, 2024 01:01
carlossanlop added a commit to carlossanlop/runtime that referenced this pull request Jun 5, 2024
…tnet#102053)

* ZipArchiveEntry didn't set ZIP64 in local headers for small files if their offset are > 4GB.
* Added System.IO.Compression and System.IO.Packaging tests.

---------

Co-authored-by: Gan Keyu <gankeyu@hotmail.com>
carlossanlop added a commit that referenced this pull request Jun 10, 2024
…02053) (#103006)

* ZipArchiveEntry didn't set ZIP64 in local headers for small files if their offset are > 4GB.
* Added System.IO.Compression and System.IO.Packaging tests.

---------

Co-authored-by: Gan Keyu <gankeyu@hotmail.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants