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

Unified Diff: test/cctest/wasm/test-run-wasm.cc

Issue 1601843002: [wasm] Add test for non-misaligned OOB access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 445c3f0aedb73c2f9a806fcc21f95a964571a86a..196aea4f57e9aebf872d4f4c5805b50992300e74 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -1545,10 +1545,10 @@ TEST(Run_Wasm_LoadMemI32_offset) {
}
-// TODO(titzer): Fix for mips and re-enable.
#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
-TEST(Run_Wasm_LoadMemI32_const_oob) {
+TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
+ // TODO(titzer): Fix misaligned accesses on MIPS and re-enable.
TestingModule module;
const int kMemSize = 12;
module.AddMemoryElems<byte>(kMemSize);
@@ -1574,6 +1574,30 @@ TEST(Run_Wasm_LoadMemI32_const_oob) {
#endif
+TEST(Run_Wasm_LoadMemI32_const_oob) {
+ TestingModule module;
+ const int kMemSize = 24;
+ module.AddMemoryElems<byte>(kMemSize);
+
+ for (int offset = 0; offset < kMemSize + 5; offset += 4) {
+ for (int index = 0; index < kMemSize + 5; index += 4) {
+ WasmRunner<int32_t> r;
+ r.env()->module = &module;
+ module.RandomizeMemory();
+
+ BUILD(r,
+ WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index)));
+
+ if ((offset + index) <= (kMemSize - sizeof(int32_t))) {
+ CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call());
+ } else {
+ CHECK_TRAP(r.Call());
+ }
+ }
+ }
+}
+
+
TEST(Run_Wasm_StoreMemI32_offset) {
WasmRunner<int32_t> r(MachineType::Int32());
const int32_t kWritten = 0xaabbccdd;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698