summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-05-31 10:50:16 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-06-01 13:18:18 -0700
commit9b3594b4c704d8562b583da7f27711373ff17f3c (patch)
tree717de2eb11d4fde834abf022e0540e68cff938b0
parentfd71c67747c3a85db9670a0d558670c4cb124c91 (diff)
downloadbinaryen-9b3594b4c704d8562b583da7f27711373ff17f3c.tar.gz
binaryen-9b3594b4c704d8562b583da7f27711373ff17f3c.tar.bz2
binaryen-9b3594b4c704d8562b583da7f27711373ff17f3c.zip
fix fuzz-exec catching of traps, they can occur during init, not just call
-rw-r--r--src/tools/wasm-opt.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tools/wasm-opt.cpp b/src/tools/wasm-opt.cpp
index 35d5b6787..184dbae1b 100644
--- a/src/tools/wasm-opt.cpp
+++ b/src/tools/wasm-opt.cpp
@@ -73,15 +73,16 @@ struct ExecutionResults {
Literal run(Function* func, Module& wasm) {
ShellExternalInterface interface;
- ModuleInstance instance(wasm, &interface);
- LiteralList arguments;
- for (WasmType param : func->params) {
- // zeros in arguments TODO: more?
- arguments.push_back(Literal(param));
- }
try {
+ ModuleInstance instance(wasm, &interface);
+ LiteralList arguments;
+ for (WasmType param : func->params) {
+ // zeros in arguments TODO: more?
+ arguments.push_back(Literal(param));
+ }
return instance.callFunction(func->name, arguments);
} catch (const TrapException&) {
+ // may throw in instance creation (init of offsets) or call itself
return Literal();
}
}