-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 the file offset is >4GB #94970
Conversation
ZipArchiveEntry didn't set ZIP64 in local headers for small files if their offset are >4GB.
Tagging subscribers to this area: @dotnet/area-system-io-compression Issue DetailsFix #94899. Analysis in the comments. The spec is unclear whether the versionNeeded should be same in the CD and LH, and decompressors such as 7-Zip & Windows don't complain about the discrepancy. Nevertheless I found 7-Zip set the LH to version ZIP64 under such circumstance.
|
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
Outdated
Show resolved
Hide resolved
Is there a line of sight to a resolution here? |
src/libraries/System.IO.Compression/tests/ZipArchive/zip_LargeFiles.cs
Outdated
Show resolved
Hide resolved
I think we thought we were waiting on @karakasa but I guess we're not. @carlossanlop does this change look reasonable to you - as you are best versed in the code/ the format? |
@carlossanlop - can you please review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience. Here's my review so far:
- I see that setting the value of
_offsetOfLocalHeader
a few lines earlier inWriteLocalFileHeader
is safe as it is only used in the new invocation ofShouldUseZIP64()
. - I can see the new
ShouldUseZIP64()
method has the right scope for this specific issue. - Left some suggestions for you to consider.
Please consider:
- Addressing @danmoseley 's suggestion of adding a test case that uses compression.
- Adding an extra test to
System.IO.Packaging
. We should test the original reported issue as close as possible. In thesrc/libraries/System.IO.Packaging/tests/Tests.cs
file, there is a test called VeryLargePart, which can be used as inspiration for yours. Note that VeryLargePart is creating the zip file in-memory. - Can you please test that the generated zip file can be read with external zip tools like 7-zip, windows explorer, winzip, unzip, etc? Testing reading the generated zip file with external programming languages would also be great.
Once merged, we can backport it to any requested active servicing branches (8.0 or 6.0).
src/libraries/System.IO.Compression/tests/ZipArchive/zip_LargeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_LargeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_LargeFiles.cs
Outdated
Show resolved
Hide resolved
@karakasa thanks for your patience. Do you expect to be able to continue with this PR, and address the feedback? |
Sure.
May you elaborate how to achieve that? I believe the objective is essentially executing a single test, while the first part runs in the latest .NET and the second part runs in the .NET Framework. The
I have tested. Is replying this PR with images sufficient? |
Yes, absolutely. And thank you for doing that.
My suggestion is that you open |
@karakasa please let us know if you'll be able to continue looking into this. Otherwise, I can take over. |
Go ahead. Apologize I don’t have resources recently. |
No worries, @karakasa. Thanks anyway for helping move this along. |
Fix #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.