Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "test/unittests/test-utils.h" | 5 #include "test/unittests/test-utils.h" |
| 6 | 6 |
| 7 #include "src/handles.h" | 7 #include "src/handles.h" |
| 8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
| 9 #include "src/wasm/module-decoder.h" | 9 #include "src/wasm/module-decoder.h" |
| 10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); | 468 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); |
| 469 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); | 469 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); |
| 470 EXPECT_EQ(10, s1->source_size); | 470 EXPECT_EQ(10, s1->source_size); |
| 471 | 471 |
| 472 if (result.val) delete result.val; | 472 if (result.val) delete result.val; |
| 473 } | 473 } |
| 474 | 474 |
| 475 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); | 475 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); |
| 476 } | 476 } |
| 477 | 477 |
| 478 TEST_F(WasmModuleVerifyTest, MaxMaximumMemorySize) { | |
|
titzer
2016/11/07 11:41:57
Can you also add a negative test?
ahaas
2016/11/07 11:52:17
Done.
| |
| 479 const byte data[] = { | |
| 480 SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0, | |
| 481 U32V_3(65536), | |
| 482 }; | |
| 483 | |
| 484 EXPECT_VERIFIES(data); | |
| 485 } | |
| 486 | |
| 478 TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) { | 487 TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) { |
| 479 const byte data[] = { | 488 const byte data[] = { |
| 480 SECTION(Memory, 4), | 489 SECTION(Memory, 4), |
| 481 ENTRY_COUNT(1), | 490 ENTRY_COUNT(1), |
| 482 kResizableMaximumFlag, | 491 kResizableMaximumFlag, |
| 483 28, | 492 28, |
| 484 28, | 493 28, |
| 485 SECTION(Data, 11), | 494 SECTION(Data, 11), |
| 486 ENTRY_COUNT(1), | 495 ENTRY_COUNT(1), |
| 487 LINEAR_MEMORY_INDEX_0, | 496 LINEAR_MEMORY_INDEX_0, |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1287 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- | 1296 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- |
| 1288 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- | 1297 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- |
| 1289 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- | 1298 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- |
| 1290 }; | 1299 }; |
| 1291 EXPECT_VERIFIES(data); | 1300 EXPECT_VERIFIES(data); |
| 1292 } | 1301 } |
| 1293 | 1302 |
| 1294 } // namespace wasm | 1303 } // namespace wasm |
| 1295 } // namespace internal | 1304 } // namespace internal |
| 1296 } // namespace v8 | 1305 } // namespace v8 |
| OLD | NEW |