summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-04-21 10:46:09 -0700
committerGitHub <noreply@github.com>2022-04-21 10:46:09 -0700
commit50d596b3287f19e4ff2f1e1d4a9629968695da73 (patch)
tree132194a79fab1d67ae8ea6784e155c140dad0439 /src
parent793eabd785716247949ce6a4e6ab31c008711d08 (diff)
downloadbinaryen-50d596b3287f19e4ff2f1e1d4a9629968695da73.tar.gz
binaryen-50d596b3287f19e4ff2f1e1d4a9629968695da73.tar.bz2
binaryen-50d596b3287f19e4ff2f1e1d4a9629968695da73.zip
[NominalFuzzing] Add a validation error on ref.cast's etc. intended type (#4606)
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index bebb3eabe..c0b3e9292 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2375,6 +2375,8 @@ void FunctionValidator::visitRefTest(RefTest* curr) {
HeapType(),
curr,
"static ref.test must set intendedType field");
+ shouldBeTrue(
+ !curr->intendedType.isBasic(), curr, "ref.test must test a non-basic");
}
}
@@ -2399,6 +2401,8 @@ void FunctionValidator::visitRefCast(RefCast* curr) {
HeapType(),
curr,
"static ref.cast must set intendedType field");
+ shouldBeTrue(
+ !curr->intendedType.isBasic(), curr, "ref.cast must cast to a non-basic");
}
}
@@ -2427,6 +2431,9 @@ void FunctionValidator::visitBrOn(BrOn* curr) {
HeapType(),
curr,
"static br_on_cast* must set intendedType field");
+ shouldBeTrue(!curr->intendedType.isBasic(),
+ curr,
+ "br_on_cast* must cast to a non-basic");
}
} else {
shouldBeTrue(curr->rtt == nullptr, curr, "non-cast BrOn must not have rtt");