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

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

Issue 2342593002: [wasm] void is not a valid type for a global. (Closed)
Patch Set: Created 4 years, 3 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-macro-gen.h" 10 #include "src/wasm/wasm-macro-gen.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 TEST_F(WasmModuleVerifyTest, Global_invalid_type) { 206 TEST_F(WasmModuleVerifyTest, Global_invalid_type) {
207 static const byte data[] = { 207 static const byte data[] = {
208 SECTION(GLOBALS, 5), // -- 208 SECTION(GLOBALS, 5), // --
209 1, 209 1,
210 NAME_LENGTH(1), 210 NAME_LENGTH(1),
211 'g', // name 211 'g', // name
212 64, // invalid memory type 212 64, // invalid memory type
213 0, // exported 213 0, // exported
214 }; 214 };
215 215
216 ModuleResult result = DecodeModuleNoHeader(data, data + sizeof(data)); 216 ModuleResult result = DecodeModule(data, data + sizeof(data));
217 EXPECT_FALSE(result.ok()); 217 EXPECT_FALSE(result.ok());
218 if (result.val) delete result.val; 218 if (result.val) delete result.val;
219 } 219 }
220
221 TEST_F(WasmModuleVerifyTest, Global_invalid_type2) {
222 static const byte data[] = {
223 SECTION(GLOBALS, 5), // --
224 1,
225 NAME_LENGTH(1),
226 'g', // name
227 kLocalVoid, // invalid memory type
228 0, // exported
229 };
230
231 ModuleResult result = DecodeModule(data, data + sizeof(data));
232 EXPECT_FALSE(result.ok());
233 if (result.val) delete result.val;
234 }
220 235
221 TEST_F(WasmModuleVerifyTest, ZeroGlobals) { 236 TEST_F(WasmModuleVerifyTest, ZeroGlobals) {
222 static const byte data[] = { 237 static const byte data[] = {
223 SECTION(GLOBALS, 1), // -- 238 SECTION(GLOBALS, 1), // --
224 0, // declare 0 globals 239 0, // declare 0 globals
225 }; 240 };
226 ModuleResult result = DecodeModule(data, data + arraysize(data)); 241 ModuleResult result = DecodeModule(data, data + arraysize(data));
227 EXPECT_OK(result); 242 EXPECT_OK(result);
228 if (result.val) delete result.val; 243 if (result.val) delete result.val;
229 } 244 }
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 NO_LOCAL_NAMES, // -- 1245 NO_LOCAL_NAMES, // --
1231 FOO_STRING, 1246 FOO_STRING,
1232 NO_LOCAL_NAMES, // -- 1247 NO_LOCAL_NAMES, // --
1233 }; 1248 };
1234 EXPECT_VERIFIES(data); 1249 EXPECT_VERIFIES(data);
1235 } 1250 }
1236 1251
1237 } // namespace wasm 1252 } // namespace wasm
1238 } // namespace internal 1253 } // namespace internal
1239 } // namespace v8 1254 } // 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