-
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
Remove local header compressed/uncomressed size validation vs central directory records #32149
Conversation
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
.../System.IO.Compression/src/System/IO/Compression/PositionPreservingWriteOnlyStreamWrapper.cs
Outdated
Show resolved
Hide resolved
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.
Looks good to me. Nice work here, @buyaa-n.
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipHelper.cs
Outdated
Show resolved
Hide resolved
We are having test failures for Mac mono and Linux mono test run. From my search result https://github.com/mono/mono/pull/7233/files#diff-d4a99dd2b7df29f027dae0b3eec6c8e6R31 seems in mono tests using RemoteExecutor need to be defined in the make file or wherever it is set now. I was not able to find the make file above from runtime repo so looking for mono devs help on it CC @akoeplinger @directhex Other test failures are unrelated |
That's no longer the case with the mono used in dotnet/runtime. From the test result I can see that the RemoteExecutor worked fine but hit an exception in the test:
This only seems to happen for the I'd suggest filing a bug and disabling that test with |
There is a static variable caching |
…alidation_update
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipBlocks.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
…to zip_validation_update
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
Please help add (exactly one) |
Fixes #1094
In 3.0 we have added local header validation against central directory data due to #27741 which was breaking change as zip archives with invalid or non standard header is now fail to extract.
While investigating #1094 @eerhardt found a bug in Data Descriptor section read, meanwhile other people commented on the bug about more issues they are having with the change. There is 3 main issues reported:
Bug caused from reading the value using ReadIn32t instead of ReadUInt32
DD value for ZIP64 format written in the way we didn't expect (apparently some zip tools produces it differently)
DD bit is set but the DD section is missing. Compressed/Uncompressed size values set in the original position in the stream.
After investigating the issue with the team we decided to use more forgiving logic for validation same as in WPF so that allow acceptable zips pass the validation. This change will fix first 2 scenarios above. The 3rd scenario is an invalid zip for which the validation would fail. In case customers still want to extract such zip they could use AppContext switch we added with this PR which disables the the validation