From 50d596b3287f19e4ff2f1e1d4a9629968695da73 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 21 Apr 2022 10:46:09 -0700 Subject: [NominalFuzzing] Add a validation error on ref.cast's etc. intended type (#4606) --- src/wasm/wasm-validator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/wasm/wasm-validator.cpp') 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"); -- cgit v1.2.3