Repository navigation
interp: Handle ref.null exn - #2497
Merged
Merged
Conversation
sbc100
approved these changes
Oct 29, 2024
sbc100
pushed a commit
that referenced
this pull request
Oct 28, 2026
PeekMatchRefType() admits `(ref ...)` when either function-references or exceptions is enabled. Exceptions is on by default and function-references is off, so with no flags the shorthand `(ref func)`, the index form `(ref 0)` and the named form `(ref $t)` all reach the typed reference parsing paths. The named form then trips `assert(function_references_enabled())` in ParseValueTypeList and ParseBoundValueTypeList, an abort in assert-enabled builds reachable from untrusted .wat through wat2wasm and wast2json. The exceptions condition came in with #2497, but nothing there needs it. The exception-handling spec tests only use the `ref.null exn` instruction, never a `(ref ...)` type. This gates PeekMatchRefType() on function-references alone, so every `(ref ...)` form is rejected with the parser's usual unexpected-token error when the feature is off, and the two asserts hold again. `exnref` and `ref.null exn` still parse with exceptions on, and `--enable-function-references` is unchanged. Found by fuzzing the wat2wasm harness. Full run-tests.py suite and the 135 gtests pass.
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.
No description provided.