Chromium Code Reviews| Index: src/wasm/ast-decoder.cc |
| diff --git a/src/wasm/ast-decoder.cc b/src/wasm/ast-decoder.cc |
| index ea7ddcf52813b5f2b6dcdfd0c2a56403b3ab7c13..9075acf7d9c654d64c64d9421aa8a97646c54a83 100644 |
| --- a/src/wasm/ast-decoder.cc |
| +++ b/src/wasm/ast-decoder.cc |
| @@ -1136,14 +1136,17 @@ class WasmFullDecoder : public WasmDecoder { |
| break; |
| } |
| case kExprCallIndirect: { |
| + uint32_t table_index = 0; |
| CallIndirectOperand operand(this, pc_); |
| - if (Validate(pc_, operand)) { |
| + if (Validate(pc_, operand) && module_->IsValidTable(table_index)) { |
|
titzer
2016/11/07 09:24:11
Why not just move this logic into the Validate met
ahaas
2016/11/07 09:35:56
Done. I misunderstood the Validate method.
|
| Value index = Pop(0, kAstI32); |
| TFNode** buffer = PopArgs(operand.sig); |
| if (buffer) buffer[0] = index.node; |
| TFNode** rets = nullptr; |
| BUILD(CallIndirect, operand.index, buffer, &rets, position()); |
| PushReturns(operand.sig, rets); |
| + } else { |
| + error("function table has to exist to execute call_indirect"); |
| } |
| len = 1 + operand.length; |
| break; |