Skip to content

Fix allocating type ids beyond wasmparser's implementation limit - #2687

Merged
fitzgen merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-an-id-panic
Sep 29, 2026
Merged

fitzgen merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:fix-an-id-panic

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

The design of PackedIndex and RefType and such is intended to ensure that any one single core module can validate correctly but this does not work when a component might contain multiple core modules. In such a situation wasmparser would previously panic when creating RefTypes from internally-allocated IDs because the ID didn't fit within a PackedIndex. The fix applied here is to have rec-group registration be fallible and test the implementation limits before committing to insert a rec group.

The design of `PackedIndex` and `RefType` and such is intended to ensure
that any one single core module can validate correctly but this does not
work when a component might contain multiple core modules. In such a
situation wasmparser would previously panic when creating `RefType`s
from internally-allocated IDs because the ID didn't fit within a
`PackedIndex`. The fix applied here is to have rec-group registration be
fallible and test the implementation limits before committing to insert
a rec group.
@alexcrichton
alexcrichton requested a review from a team as a code owner September 28, 2026 19:49
@alexcrichton
alexcrichton requested review from fitzgen and pchickey and removed request for a team and pchickey September 28, 2026 19:49
@fitzgen
fitzgen added this pull request to the merge queue Sep 29, 2026
Merged via the queue into bytecodealliance:main with commit 3db87e6 Sep 29, 2026
37 checks passed
@alexcrichton
alexcrichton deleted the fix-an-id-panic branch September 29, 2026 22:24
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.

2 participants