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

Side by Side Diff: test/cctest/wasm/wasm-run-utils.h

Issue 2640453003: [wasm] Fix and tighten memory validation (Closed)
Patch Set: Created 3 years, 11 months 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H 5 #ifndef WASM_RUN_UTILS_H
6 #define WASM_RUN_UTILS_H 6 #define WASM_RUN_UTILS_H
7 7
8 #include <setjmp.h> 8 #include <setjmp.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 interpreter_(mode == kExecuteInterpreted 82 interpreter_(mode == kExecuteInterpreted
83 ? new WasmInterpreter( 83 ? new WasmInterpreter(
84 ModuleBytesEnv(&module_, &instance_, 84 ModuleBytesEnv(&module_, &instance_,
85 Vector<const byte>::empty()), 85 Vector<const byte>::empty()),
86 zone->allocator()) 86 zone->allocator())
87 : nullptr) { 87 : nullptr) {
88 WasmJs::Install(isolate_); 88 WasmJs::Install(isolate_);
89 instance->module = &module_; 89 instance->module = &module_;
90 instance->globals_start = global_data; 90 instance->globals_start = global_data;
91 module_.globals_size = kMaxGlobalsSize; 91 module_.globals_size = kMaxGlobalsSize;
92 module_.has_memory = true;
titzer 2017/01/18 10:17:30 Shouldn't you set this in AddMemory() below?
rossberg 2017/01/18 11:28:09 Done.
92 instance->mem_start = nullptr; 93 instance->mem_start = nullptr;
93 instance->mem_size = 0; 94 instance->mem_size = 0;
94 memset(global_data, 0, sizeof(global_data)); 95 memset(global_data, 0, sizeof(global_data));
95 instance_object_ = InitInstanceObject(); 96 instance_object_ = InitInstanceObject();
96 } 97 }
97 98
98 ~TestingModule() { 99 ~TestingModule() {
99 if (instance->mem_start) { 100 if (instance->mem_start) {
100 free(instance->mem_start); 101 free(instance->mem_start);
101 } 102 }
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 void RunWasm_##name(WasmExecutionMode execution_mode) 812 void RunWasm_##name(WasmExecutionMode execution_mode)
812 813
813 #define WASM_EXEC_COMPILED_TEST(name) \ 814 #define WASM_EXEC_COMPILED_TEST(name) \
814 void RunWasm_##name(WasmExecutionMode execution_mode); \ 815 void RunWasm_##name(WasmExecutionMode execution_mode); \
815 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ 816 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \
816 void RunWasm_##name(WasmExecutionMode execution_mode) 817 void RunWasm_##name(WasmExecutionMode execution_mode)
817 818
818 } // namespace 819 } // namespace
819 820
820 #endif 821 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698