summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-04-08 18:06:15 -0700
committerGitHub <noreply@github.com>2021-04-08 18:06:15 -0700
commit8498027da4e078e6babe72f66829b479dd163510 (patch)
tree882048ce758b06d32c3875eb4d72d6574dfe1071 /src/wasm/wasm-binary.cpp
parent8e20e49a858f207e689589dfe9c056098c58eca2 (diff)
downloadbinaryen-8498027da4e078e6babe72f66829b479dd163510.tar.gz
binaryen-8498027da4e078e6babe72f66829b479dd163510.tar.bz2
binaryen-8498027da4e078e6babe72f66829b479dd163510.zip
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.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp3
1 files changed, 1 insertions, 2 deletions
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);
}