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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 2484623002: [wasm] Indirect calls without function table cause validation errors. (Closed)
Patch Set: try to export symbols 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 unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/signature-map.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 inline bool Complete(const byte* pc, CallIndirectOperand& operand) { 220 inline bool Complete(const byte* pc, CallIndirectOperand& operand) {
221 ModuleEnv* m = module_; 221 ModuleEnv* m = module_;
222 if (m && m->module && operand.index < m->module->signatures.size()) { 222 if (m && m->module && operand.index < m->module->signatures.size()) {
223 operand.sig = m->module->signatures[operand.index]; 223 operand.sig = m->module->signatures[operand.index];
224 return true; 224 return true;
225 } 225 }
226 return false; 226 return false;
227 } 227 }
228 228
229 inline bool Validate(const byte* pc, CallIndirectOperand& operand) { 229 inline bool Validate(const byte* pc, CallIndirectOperand& operand) {
230 uint32_t table_index = 0;
231 if (!module_->IsValidTable(table_index)) {
232 error("function table has to exist to execute call_indirect");
233 return false;
234 }
230 if (Complete(pc, operand)) { 235 if (Complete(pc, operand)) {
231 return true; 236 return true;
232 } 237 }
233 error(pc, pc + 1, "invalid signature index: #%u", operand.index); 238 error(pc, pc + 1, "invalid signature index: #%u", operand.index);
234 return false; 239 return false;
235 } 240 }
236 241
237 inline bool Validate(const byte* pc, BreakDepthOperand& operand, 242 inline bool Validate(const byte* pc, BreakDepthOperand& operand,
238 ZoneVector<Control>& control) { 243 ZoneVector<Control>& control) {
239 if (operand.depth < control.size()) { 244 if (operand.depth < control.size()) {
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2035 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2031 const byte* start, const byte* end) { 2036 const byte* start, const byte* end) {
2032 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2037 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2033 WasmFullDecoder decoder(zone, nullptr, body); 2038 WasmFullDecoder decoder(zone, nullptr, body);
2034 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2039 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2035 } 2040 }
2036 2041
2037 } // namespace wasm 2042 } // namespace wasm
2038 } // namespace internal 2043 } // namespace internal
2039 } // namespace v8 2044 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/signature-map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698