Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: src/wasm/ast-decoder.cc

Issue 2484623002: [wasm] Indirect calls without function table cause validation errors. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698