summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-05-18 14:22:16 -0700
committerGitHub <noreply@github.com>2022-05-18 14:22:16 -0700
commit5e613af62b466cb8a9a235a4ea64ace2e003aaa8 (patch)
tree91f00ab77ec91bc1defe05264afb7d6277f9d616 /src/wasm/wasm-validator.cpp
parent12f59507ee65b29ce08f37089594f752f846af9d (diff)
downloadbinaryen-5e613af62b466cb8a9a235a4ea64ace2e003aaa8.tar.gz
binaryen-5e613af62b466cb8a9a235a4ea64ace2e003aaa8.tar.bz2
binaryen-5e613af62b466cb8a9a235a4ea64ace2e003aaa8.zip
Validator: Check features for ref.null's type (#4677)
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 39eb996ea..c74d95fdd 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1999,6 +1999,11 @@ void FunctionValidator::visitRefNull(RefNull* curr) {
"ref.null requires reference-types to be enabled");
shouldBeTrue(
curr->type.isNullable(), curr, "ref.null types must be nullable");
+
+ // The type of the null must also be valid for the features.
+ shouldBeTrue(curr->type.getFeatures() <= getModule()->features,
+ curr->type,
+ "ref.null type should be allowed");
}
void FunctionValidator::visitRefIs(RefIs* curr) {