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-binary.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/wasm/wasm-binary.cpp') diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 3ff98187f..ed18cc0e4 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -2856,8 +2856,7 @@ void WasmBinaryBuilder::readElementSegments() { Index index = getU32LEB(); auto sig = getSignatureByFunctionIndex(index); // Use a placeholder name for now - auto* refFunc = Builder(wasm).makeRefFunc( - Name::fromInt(index), Type(HeapType(sig), Nullable)); + auto* refFunc = Builder(wasm).makeRefFunc(Name::fromInt(index), sig); functionRefs[index].push_back(refFunc); segmentData.push_back(refFunc); } -- cgit v1.2.3