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

Side by Side Diff: test/unittests/wasm/module-decoder-unittest.cc

Issue 2486973003: [wasm] Data section without memory causes a validation error (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 unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | 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 "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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); 509 EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const);
510 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); 510 EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset);
511 EXPECT_EQ(10, s1->source_size); 511 EXPECT_EQ(10, s1->source_size);
512 512
513 if (result.val) delete result.val; 513 if (result.val) delete result.val;
514 } 514 }
515 515
516 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); 516 EXPECT_OFF_END_FAILURE(data, 14, sizeof(data));
517 } 517 }
518 518
519 TEST_F(WasmModuleVerifyTest, DataWithoutMemory) {
520 const byte data[] = {
521 SECTION(Data, 11),
522 ENTRY_COUNT(1),
523 LINEAR_MEMORY_INDEX_0,
524 WASM_INIT_EXPR_I32V_3(0x9bbaa), // dest addr
525 U32V_1(3), // source size
526 'a',
527 'b',
528 'c' // data bytes
529 };
530 EXPECT_FAILURE(data);
531 }
532
519 TEST_F(WasmModuleVerifyTest, MaxMaximumMemorySize) { 533 TEST_F(WasmModuleVerifyTest, MaxMaximumMemorySize) {
520 { 534 {
521 const byte data[] = { 535 const byte data[] = {
522 SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0, 536 SECTION(Memory, 6), ENTRY_COUNT(1), kResizableMaximumFlag, 0,
523 U32V_3(65536), 537 U32V_3(65536),
524 }; 538 };
525 EXPECT_VERIFIES(data); 539 EXPECT_VERIFIES(data);
526 } 540 }
527 { 541 {
528 const byte data[] = { 542 const byte data[] = {
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- 1390 SECTION(Unknown, 4), 1, 'X', 17, 18, // --
1377 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- 1391 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // --
1378 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- 1392 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // --
1379 }; 1393 };
1380 EXPECT_VERIFIES(data); 1394 EXPECT_VERIFIES(data);
1381 } 1395 }
1382 1396
1383 } // namespace wasm 1397 } // namespace wasm
1384 } // namespace internal 1398 } // namespace internal
1385 } // namespace v8 1399 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698