diff options
author | Alon Zakai <azakai@google.com> | 2021-04-08 18:06:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 18:06:15 -0700 |
commit | 8498027da4e078e6babe72f66829b479dd163510 (patch) | |
tree | 882048ce758b06d32c3875eb4d72d6574dfe1071 /src/wasm/wasm-validator.cpp | |
parent | 8e20e49a858f207e689589dfe9c056098c58eca2 (diff) | |
download | binaryen-8498027da4e078e6babe72f66829b479dd163510.tar.gz binaryen-8498027da4e078e6babe72f66829b479dd163510.tar.bz2 binaryen-8498027da4e078e6babe72f66829b479dd163510.zip |
RefFunc: Validate that the type is non-nullable, and avoid possible bugs in the builder (#3790)
The builder can receive a HeapType so that callers don't need to set non-nullability
themselves.
Not NFC as some of the callers were in fact still making it nullable.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 8464a3aa9..2ac4e3187 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2001,6 +2001,8 @@ void FunctionValidator::visitRefFunc(RefFunc* curr) { shouldBeTrue(curr->type.isFunction(), curr, "ref.func must have a function reference type"); + shouldBeTrue( + !curr->type.isNullable(), curr, "ref.func must have non-nullable type"); // TODO: verify it also has a typed function references type, and the right // one, // curr->type.getHeapType().getSignature() |