Conversation
…izer HandleSimpleArrayInitializer multiplies the array dimensions to size the list it collects elements into. The dimensions come from the input assembly and need not multiply within int range, and ICSharpCode.Decompiler is built with CheckForOverflowUnderflow, so an implausible pair of dimensions aborted decompilation of the whole member. The product is only a capacity hint, so it can saturate. Found by fuzzing nuget.org; reproduces on obfuscated assemblies. Assisted-by: Claude:claude-opus-5[1m]:Claude Code
siegfriedpammer
force-pushed
the
fix-array-dimension-overflow
branch
from
August 7, 2026 05:53
799ee04 to
2f28890
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TransformArrayInitializers.HandleSimpleArrayInitializermultiplies the array dimensions to size the list it collects elements into:The dimensions come from the input assembly and need not multiply within
intrange.ICSharpCode.Decompileris built withCheckForOverflowUnderflow, so this throws instead of wrapping, and theOverflowExceptionaborts decompilation of the whole member:Fix
The product is used only as the initial capacity of
valuesListand has no bearing on the result, so it can saturate instead of overflowing.Testing
A
new int[65536, 65536]case added to theMultidimensionalArrayfixture, whose dimensions multiply to more thanint.MaxValue. It fails without the fix with the stack above.Full
ILSpy.XPlat.slnfsuite: 3366 tests, 0 failed, 44 skipped (Windows-only).How it was found
Fuzzing the nuget.org catalog through the decompiler; the original hit was an obfuscated assembly.
Written by an AI agent (Claude) on Siegfried's behalf.