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 985a38be5..ac68cbe56 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1505,6 +1505,9 @@ void WasmBinaryBuilder::processFunctions() {
auto index = exportIndexes[curr];
switch (curr->kind) {
case ExternalKind::Function: {
+ if (index >= wasm.functions.size()) {
+ throwError("bad function export index");
+ }
curr->value = getFunctionIndexName(index);
break;
}