From 8498027da4e078e6babe72f66829b479dd163510 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 8 Apr 2021 18:06:15 -0700 Subject: 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. --- src/wasm/wasm-validator.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/wasm/wasm-validator.cpp') 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() -- cgit v1.2.3