Skip to content

[stack-switching] Fix type index conflation in translation of switch - #14085

Open
dhil wants to merge 1 commit into
bytecodealliance:mainfrom
dhil:switch-type-index
Open

[stack-switching] Fix type index conflation in translation of switch#14085
dhil wants to merge 1 commit into
bytecodealliance:mainfrom
dhil:switch-type-index

Conversation

@dhil

@dhil dhil commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I came across this bug whilst working on fixing the interaction between GC and stack switching. I have hoisted it here as tiny self-contained PR.

The translation of switch would erroneously decompose a ModuleInternedTypeIndex and use its u32 representation to build a TypeIndex. The two index types map different spaces, consequently it is possible to cause a compiler crash (out of bounds on lookup) or worse a runtime crash (argument types mismatch).

@dhil
dhil requested review from a team as code owners August 6, 2026 18:02
@dhil
dhil requested review from alexcrichton and removed request for a team August 6, 2026 18:02
@dhil dhil closed this Aug 6, 2026
@dhil dhil reopened this Aug 6, 2026
…itch`

The translation of `switch` would erroneously decompose a
`ModuleInternedTypeIndex` and use its `u32` representation to build a
`TypeIndex`. The two index types map different spaces, consequently it
is possible to cause a compiler crash (out of bounds on lookup) or
worse a runtime crash (argument types mismatch).
@dhil
dhil force-pushed the switch-type-index branch from e240fd4 to f37d193 Compare August 6, 2026 20:47
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