Repository navigation
Reject (ref ...) value types without function-references - #2864
Merged
sbc100 merged 2 commits intoOct 28, 2026
Merged
Conversation
Collaborator
|
Why rejecting named refs only? Without typed function references |
PeekMatchRefType() also admitted (ref ...) when only exceptions was enabled, so the shorthand, index and named forms all reached the typed reference parsing paths with function-references off. Gate it on function-references alone, which restores the asserts in ParseValueTypeList and ParseBoundValueTypeList, and cover every form in the test.
Contributor
Author
|
Agreed. The exceptions condition in PeekMatchRefType() was letting Pushed a version that gates PeekMatchRefType() on function-references alone. Every |
Contributor
Author
|
gentle ping |
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.
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 tripsassert(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 exninstruction, 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.exnrefandref.null exnstill parse with exceptions on, and--enable-function-referencesis unchanged.Found by fuzzing the wat2wasm harness. Full run-tests.py suite and the 135 gtests pass.