-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Avoid IndexOutOfRangeException in ZipArchive #109168
Avoid IndexOutOfRangeException in ZipArchive #109168
Conversation
Hello, @ericstj , @dotnet/area-system-io-compression ! |
src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/HuffmanTree.cs
Show resolved
Hide resolved
An IndexOutOfRangeException exception is thrown when this invalid zip file is opened with ZipArchive. This file is generated while fuzzing ZipArchive with AFL++. More details in issue and pull request: dotnet/runtime#109167 dotnet/runtime#109168
An IndexOutOfRangeException exception is thrown when this invalid zip file is opened with ZipArchive. This file is generated while fuzzing ZipArchive with AFL++. More details in issue and pull request: dotnet/runtime#109167 dotnet/runtime#109168
@peter15914 FYI you'll need to wait until #109477 is merged to be able to consume the runtime-assets changes. Once that PR is in you can merge main into your branch and you should be able to access the new file. |
Add test to cover problem with invalid zip file. Currently an IndexOutOfRangeException is thrown when invalid zip file is opened with ZipArchive.
@dotnet-policy-service agree |
Hello @stephentoub ! |
Thanks! |
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
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.
Left a small suggestion, but I'd like @carlossanlop to review too
src/libraries/System.IO.Compression/tests/ZipArchive/zip_InvalidParametersAndStrangeFiles.cs
Outdated
Show resolved
Hide resolved
Change "Theory" to "Fact" Co-authored-by: Eric StJohn <ericstj@microsoft.com>
@carlossanlop PTAL |
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.
LGTM. The condition makes sense and the test verifies the reported scenario.
/ba-g a lot of timeouts in different legs for which we already have dnceng issues |
Fixes #109167
This pull request fixes unexpected IndexOutOfRangeException in ZipArchive.
Additional check added that array index is not out of range.
It is done in a similar way to the code in HuffmanTree.c:230:
Found by Linux Verification Center (linuxtesting.org).