Fix validating imported globals - #2848
Open
zherczeg wants to merge 1 commit into
Open
Conversation
Found by George Vasiliades
Collaborator
Author
|
@Poseidonas fix for a bug you have found. |
|
Thanks, Zoltan — and thanks for taking it upstream. That reference-type index check is an easy one to miss, so it makes sense the same gap turns up across implementations; catching it at the toolkit level is where it matters most. Glad it landed with a regression test, and happy to help however is useful. |
zherczeg
commented
Sep 7, 2026
| ) | ||
| (;; STDERR ;;; | ||
| out/test/parse/bad-ref-globals.txt:5:42: error: reference 9997 is out of range (max: 0) in globals | ||
| (global (import "mod" "val") (ref 9997)) |
Collaborator
Author
There was a problem hiding this comment.
Note: imported / not imported globals display the error location differently.
This could be fixed by passing loc instead of GetLocation():
https://github.com/WebAssembly/wabt/blob/main/src/wast-parser.cc#L1865
There are other similar cases though.
Collaborator
Author
|
This issue is likely my fault. I did it when I implemented the function references proposal. |
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.
Found by George Vasiliades