Index: src/wasm/wasm-interpreter.cc |
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc |
index 2ac681eff293dbb1a640ebb16bf6c6e1347323a6..1d03852a2cfa33e9692151d653d91c5d854442db 100644 |
--- a/src/wasm/wasm-interpreter.cc |
+++ b/src/wasm/wasm-interpreter.cc |
@@ -1419,7 +1419,15 @@ class ThreadImpl : public WasmInterpreter::Thread { |
if (target == nullptr) { |
return DoTrap(kTrapFuncInvalid, pc); |
} else if (target->function->sig_index != operand.index) { |
- return DoTrap(kTrapFuncSigMismatch, pc); |
+ // If not an exact match, we have to do a canonical check. |
+ const WasmIndirectFunctionTable* table = |
Clemens Hammacher
2016/10/10 17:35:03
Maybe place a TODO to think about caching this ins
titzer
2016/10/10 17:45:21
Added a TODO here.
|
+ &module()->function_tables[0]; |
+ int function_key = table->map_.Find(target->function->sig); |
+ if (function_key < 0 || |
+ (function_key != |
+ table->map_.Find(module()->signatures[operand.index]))) { |
+ return DoTrap(kTrapFuncSigMismatch, pc); |
+ } |
} |
DoCall(target, &pc, pc + 1 + operand.length, &limit); |