Skip to content

Report compiler-generated names leaking into decompiled output - #4128

Merged
siegfriedpammer merged 1 commit into
masterfrom
tests/nugetfuzz-leaked-names
Sep 9, 2026
Merged

Report compiler-generated names leaking into decompiled output#4128
siegfriedpammer merged 1 commit into
masterfrom
tests/nugetfuzz-leaked-names

Conversation

@siegfriedpammer

Copy link
Copy Markdown
Member

decompdiff measured leaked compiler-generated names by counting the substring <> in the output text. That both missed mangled names without it (VB$AnonymousType_0, <Main>$) and counted every generic argument list followed by an identifier character. It only has output text, so the shapes stay lexical there, but the pattern is now written to match what the decompiler itself considers generated.

nugetfuzz has the syntax tree, so it checks identifiers directly against the decompiler's own rule (EscapeInvalidIdentifiers.IsValid: letters, digits and _). Anything else is a compiler-generated entity that was not folded away, and the output does not compile. Findings are bucketed by the shape of the name -- the bracketed part is the enclosing member and the digits are per occurrence -- so one unfolded construct stays one finding instead of one per member it hit.

Also fixes a defect in the HTML report: its kind list is the render loop's only source of sections, and the PDB bucket added with the PDB verification mode was never in it, so PDB findings never appeared in the report.

Verified with a run over System.Text.Json@9.0.0: 6 hits in 2 buckets, including the known <>y__InlineArray<N> leak from ref-struct inline arrays. Mono.Cecil@0.11.6 and Polly.Core@8.4.2 come back clean.

This PR was prepared by an AI agent (Claude Code) on my behalf.

decompdiff counted the substring "<>" in the output text, which both missed
mangled names that do not contain it ("VB$AnonymousType_0", "<Main>$") and
counted every generic argument list ending in an identifier character. The
shape is matched lexically there because only text is available; nugetfuzz has
the syntax tree, so it applies the decompiler's own identifier rule
(EscapeInvalidIdentifiers.IsValid) to the tree's identifiers instead, and any
hit is output that does not compile. Findings collapse to the shape of the
name because the bracketed part and the digits vary per occurrence, so one
unfolded construct stays one finding rather than one per member it hit.

The report's kind list is also the render loop's only source of sections, so
the PDB bucket added with the PDB verification mode never reached the HTML.

Assisted-by: Claude:claude-opus-5:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 48a9d9a into master Sep 9, 2026
17 checks passed
@siegfriedpammer
siegfriedpammer deleted the tests/nugetfuzz-leaked-names branch September 9, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant