summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/fuzzing/fuzzing.cpp2
-rw-r--r--src/wasm/wasm-validator.cpp5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 22006a6a1..01196540b 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -3045,6 +3045,8 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) {
HeapType::data));
case HeapType::eq:
// TODO: nontrivial types as well.
+ assert(wasm.features.hasReferenceTypes());
+ assert(wasm.features.hasGC());
return pick(HeapType::eq, HeapType::i31, HeapType::data);
case HeapType::i31:
return HeapType::i31;
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) {