diff options
Diffstat (limited to 'src/shell-interface.h')
-rw-r--r-- | src/shell-interface.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shell-interface.h b/src/shell-interface.h index 1bbe97dd9..c07203a92 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -147,13 +147,16 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { LiteralList& arguments, Type result, ModuleInstance& instance) override { - if (index >= table.size()) + if (index >= table.size()) { trap("callTable overflow"); + } auto* func = instance.wasm.getFunctionOrNull(table[index]); - if (!func) + if (!func) { trap("uninitialized table element"); - if (func->params.size() != arguments.size()) + } + if (func->params.size() != arguments.size()) { trap("callIndirect: bad # of arguments"); + } for (size_t i = 0; i < func->params.size(); i++) { if (func->params[i] != arguments[i].type) { trap("callIndirect: bad argument type"); |