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-limits.h" | 10 #include "src/wasm/wasm-limits.h" |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 NAME_LENGTH(1), // -- | 1094 NAME_LENGTH(1), // -- |
1095 'f', // global name | 1095 'f', // global name |
1096 kExternalGlobal, // import kind | 1096 kExternalGlobal, // import kind |
1097 kLocalI32, // type | 1097 kLocalI32, // type |
1098 1, // mutability | 1098 1, // mutability |
1099 }; | 1099 }; |
1100 EXPECT_FAILURE(data); | 1100 EXPECT_FAILURE(data); |
1101 } | 1101 } |
1102 } | 1102 } |
1103 | 1103 |
| 1104 TEST_F(WasmModuleVerifyTest, ImportTable_mutability_malformed) { |
| 1105 static const byte data[] = { |
| 1106 SECTION(Import, 8), |
| 1107 1, // -- |
| 1108 NAME_LENGTH(1), // -- |
| 1109 'm', // module name |
| 1110 NAME_LENGTH(1), // -- |
| 1111 'g', // global name |
| 1112 kExternalGlobal, // import kind |
| 1113 kLocalI32, // type |
| 1114 2, // invalid mutability |
| 1115 }; |
| 1116 EXPECT_FAILURE(data); |
| 1117 } |
| 1118 |
1104 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs2) { | 1119 TEST_F(WasmModuleVerifyTest, ImportTable_nosigs2) { |
1105 static const byte data[] = { | 1120 static const byte data[] = { |
1106 SECTION(Import, 6), 1, // sig table | 1121 SECTION(Import, 6), 1, // sig table |
1107 NAME_LENGTH(1), 'm', // module name | 1122 NAME_LENGTH(1), 'm', // module name |
1108 NAME_LENGTH(1), 'f', // function name | 1123 NAME_LENGTH(1), 'f', // function name |
1109 kExternalFunction, // import kind | 1124 kExternalFunction, // import kind |
1110 IMPORT_SIG_INDEX(0), // sig index | 1125 IMPORT_SIG_INDEX(0), // sig index |
1111 }; | 1126 }; |
1112 EXPECT_FAILURE(data); | 1127 EXPECT_FAILURE(data); |
1113 } | 1128 } |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 } | 1515 } |
1501 | 1516 |
1502 TEST_F(WasmModuleVerifyTest, Multiple_Named_Sections) { | 1517 TEST_F(WasmModuleVerifyTest, Multiple_Named_Sections) { |
1503 static const byte data[] = { | 1518 static const byte data[] = { |
1504 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- | 1519 SECTION(Unknown, 4), 1, 'X', 17, 18, // -- |
1505 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- | 1520 SECTION(Unknown, 9), 3, 'f', 'o', 'o', 5, 6, 7, 8, 9, // -- |
1506 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- | 1521 SECTION(Unknown, 8), 5, 'o', 't', 'h', 'e', 'r', 7, 8, // -- |
1507 }; | 1522 }; |
1508 EXPECT_VERIFIES(data); | 1523 EXPECT_VERIFIES(data); |
1509 } | 1524 } |
1510 | |
1511 } // namespace wasm | 1525 } // namespace wasm |
1512 } // namespace internal | 1526 } // namespace internal |
1513 } // namespace v8 | 1527 } // namespace v8 |
OLD | NEW |