Repository navigation
Reject invalid enum underlying metadata - #4331
Open
siegfriedpammer wants to merge 1 commit into
Open
siegfriedpammer wants to merge 1 commit into
siegfriedpammer wants to merge 1 commit into
Conversation
Enum conversion assumes the value__ field has a scalar primitive underlying type. Treat malformed signatures such as arrays as non-enums, preventing ConvertTo from recursively retrying an unchanged pointer-to-enum conversion while preserving supported native integer enums. Assisted-by: OpenCode:gpt-5.6-luna:OpenCode
siegfriedpammer
force-pushed
the
fix/validate-enum-underlying-type
branch
from
November 8, 2026 11:26
05e66a5 to
26c6995
Compare
This branch has not been deployed
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.
Malformed enum metadata can declare an array as the value__ field type. The C# conversion pipeline then repeatedly converts a pointer to the enum through an unknown underlying type until the process stack overflows.
Only classify enum value__ fields with supported primitive scalar underlying types as enums. Preserve the existing handling of Boolean, Char, native integers, and the standard signed/unsigned integral types.
Addresses scan finding ANT-2026-VS1139M4.
Tests:
OPENSSL_ENABLE_SHA1_SIGNATURES=1 dotnet test --project ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj --no-restore --report-trx --filter "FullyQualifiedName~ILPrettyTestRunner.WeirdEnums|FullyQualifiedName~TypeSystemLoaderTests"(139 passed)