Skip to content

Commit

Permalink
properly error on invalid function import indexes ; fixes #1879
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Jan 20, 2019
1 parent 8e5f247 commit 2127e64
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wasm/wasm-binary.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2127e64

Please sign in to comment.