summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-09-20 14:38:21 -0700
committerGitHub <noreply@github.com>2023-09-20 14:38:21 -0700
commit199811942d5f88d1d54158c9d7d5d5026cb1accb (patch)
treea228d05dc4dbeb5b7bca2869e1d4fad844753860 /src/wasm/wasm-binary.cpp
parentd87b995e87145e4cbfa716451e77f81ba989ac6e (diff)
downloadbinaryen-199811942d5f88d1d54158c9d7d5d5026cb1accb.tar.gz
binaryen-199811942d5f88d1d54158c9d7d5d5026cb1accb.tar.bz2
binaryen-199811942d5f88d1d54158c9d7d5d5026cb1accb.zip
Error on multivalue inputs that we do not handle (#5962)
Before in getType() we silently dropped the params of a signature type. Now we verify that it is none, or we error. Helps #5950
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 0c78442a7..e9adc5e0e 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2037,7 +2037,11 @@ Type WasmBinaryReader::getType(int initial) {
// Single value types are negative; signature indices are non-negative
if (initial >= 0) {
// TODO: Handle block input types properly.
- return getSignatureByTypeIndex(initial).results;
+ auto sig = getSignatureByTypeIndex(initial);
+ if (sig.params != Type::none) {
+ throwError("control flow inputs are not supported yet");
+ }
+ return sig.results;
}
Type type;
if (getBasicType(initial, type)) {
@@ -2088,7 +2092,7 @@ HeapType WasmBinaryReader::getIndexedHeapType() {
Type WasmBinaryReader::getConcreteType() {
auto type = getType();
if (!type.isConcrete()) {
- throw ParseException("non-concrete type when one expected");
+ throwError("non-concrete type when one expected");
}
return type;
}