summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 2b8c06c0b..9fe046c27 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1090,6 +1090,9 @@ Type WasmBinaryBuilder::getType() {
// Single value types are negative; signature indices are non-negative
if (type >= 0) {
// TODO: Handle block input types properly
+ if (size_t(type) >= signatures.size()) {
+ throwError("invalid signature index: " + std::to_string(type));
+ }
return signatures[type].results;
}
switch (type) {