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

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

Issue 2648383007: [wasm] Decoding the names section should stop if there is a problem with locals. (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
« no previous file with comments | « src/wasm/module-decoder.cc ('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-limits.h" 10 #include "src/wasm/wasm-limits.h"
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 SECTION_NAMES(1 + 10), 1454 SECTION_NAMES(1 + 10),
1455 ENTRY_COUNT(2), // -- 1455 ENTRY_COUNT(2), // --
1456 FOO_STRING, 1456 FOO_STRING,
1457 NO_LOCAL_NAMES, // -- 1457 NO_LOCAL_NAMES, // --
1458 FOO_STRING, 1458 FOO_STRING,
1459 NO_LOCAL_NAMES, // -- 1459 NO_LOCAL_NAMES, // --
1460 }; 1460 };
1461 EXPECT_VERIFIES(data); 1461 EXPECT_VERIFIES(data);
1462 } 1462 }
1463 1463
1464 TEST_F(WasmModuleVerifyTest, Regression684855) {
1465 static const byte data[] = {
1466 SECTION_NAMES(12),
1467 0xfb, // functions count
1468 0x27, // |
1469 0x00, // function name length
1470 0xff, // local names count
1471 0xff, // |
1472 0xff, // |
1473 0xff, // |
1474 0xff, // |
1475 0xff, // error: "varint too large"
1476 0xff, // |
1477 0x00, // --
1478 0x00 // --
1479 };
1480 EXPECT_VERIFIES(data);
1481 }
1482
1464 #define EXPECT_INIT_EXPR(Type, type, value, ...) \ 1483 #define EXPECT_INIT_EXPR(Type, type, value, ...) \
1465 { \ 1484 { \
1466 static const byte data[] = {__VA_ARGS__, kExprEnd}; \ 1485 static const byte data[] = {__VA_ARGS__, kExprEnd}; \
1467 WasmInitExpr expr = \ 1486 WasmInitExpr expr = \
1468 DecodeWasmInitExprForTesting(data, data + sizeof(data)); \ 1487 DecodeWasmInitExprForTesting(data, data + sizeof(data)); \
1469 EXPECT_EQ(WasmInitExpr::k##Type##Const, expr.kind); \ 1488 EXPECT_EQ(WasmInitExpr::k##Type##Const, expr.kind); \
1470 EXPECT_EQ(value, expr.val.type##_const); \ 1489 EXPECT_EQ(value, expr.val.type##_const); \
1471 } 1490 }
1472 1491
1473 TEST_F(WasmModuleVerifyTest, InitExpr_i32) { 1492 TEST_F(WasmModuleVerifyTest, InitExpr_i32) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 {19, 20, 1, 21, 2, 4}, // -- 1615 {19, 20, 1, 21, 2, 4}, // --
1597 {29, 30, 5, 35, 2, 8}, // -- 1616 {29, 30, 5, 35, 2, 8}, // --
1598 }; 1617 };
1599 1618
1600 CheckSections(data, data + sizeof(data), expected, arraysize(expected)); 1619 CheckSections(data, data + sizeof(data), expected, arraysize(expected));
1601 } 1620 }
1602 1621
1603 } // namespace wasm 1622 } // namespace wasm
1604 } // namespace internal 1623 } // namespace internal
1605 } // namespace v8 1624 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698