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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 ONE_EMPTY_BODY}; | 1016 ONE_EMPTY_BODY}; |
1017 ModuleResult result = DecodeModule(data, data + arraysize(data)); | 1017 ModuleResult result = DecodeModule(data, data + arraysize(data)); |
1018 EXPECT_OK(result); | 1018 EXPECT_OK(result); |
1019 | 1019 |
1020 EXPECT_EQ(1, result.val->functions.size()); | 1020 EXPECT_EQ(1, result.val->functions.size()); |
1021 EXPECT_EQ(1, result.val->export_table.size()); | 1021 EXPECT_EQ(1, result.val->export_table.size()); |
1022 | 1022 |
1023 if (result.val) delete result.val; | 1023 if (result.val) delete result.val; |
1024 } | 1024 } |
1025 | 1025 |
| 1026 TEST_F(WasmModuleVerifyTest, ExportNameWithInvalidStringLength) { |
| 1027 static const byte data[] = {// signatures |
| 1028 SIGNATURES_SECTION_VOID_VOID, |
| 1029 ONE_EMPTY_FUNCTION, |
| 1030 SECTION(EXPORT_TABLE, 12), |
| 1031 1, // exports |
| 1032 FUNC_INDEX(0), // -- |
| 1033 NAME_LENGTH(84), // invalid string length |
| 1034 'e', // -- |
| 1035 ONE_EMPTY_BODY}; |
| 1036 |
| 1037 EXPECT_FAILURE(data); |
| 1038 } |
| 1039 |
1026 TEST_F(WasmModuleVerifyTest, ExportTableTwo) { | 1040 TEST_F(WasmModuleVerifyTest, ExportTableTwo) { |
1027 static const byte data[] = {// signatures | 1041 static const byte data[] = {// signatures |
1028 SIGNATURES_SECTION_VOID_VOID, | 1042 SIGNATURES_SECTION_VOID_VOID, |
1029 ONE_EMPTY_FUNCTION, | 1043 ONE_EMPTY_FUNCTION, |
1030 SECTION(EXPORT_TABLE, 12), | 1044 SECTION(EXPORT_TABLE, 12), |
1031 2, // exports | 1045 2, // exports |
1032 FUNC_INDEX(0), // -- | 1046 FUNC_INDEX(0), // -- |
1033 NAME_LENGTH(4), | 1047 NAME_LENGTH(4), |
1034 'n', | 1048 'n', |
1035 'a', | 1049 'a', |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 NO_LOCAL_NAMES, // -- | 1230 NO_LOCAL_NAMES, // -- |
1217 FOO_STRING, | 1231 FOO_STRING, |
1218 NO_LOCAL_NAMES, // -- | 1232 NO_LOCAL_NAMES, // -- |
1219 }; | 1233 }; |
1220 EXPECT_VERIFIES(data); | 1234 EXPECT_VERIFIES(data); |
1221 } | 1235 } |
1222 | 1236 |
1223 } // namespace wasm | 1237 } // namespace wasm |
1224 } // namespace internal | 1238 } // namespace internal |
1225 } // namespace v8 | 1239 } // namespace v8 |
OLD | NEW |