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

Side by Side Diff: test/mjsunit/wasm/names.js

Issue 2657463003: [wasm] Errors in names section do not fail the whole module. (Closed)
Patch Set: Added a TODO Created 3 years, 10 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
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6
7 load('test/mjsunit/wasm/wasm-constants.js');
8 load('test/mjsunit/wasm/wasm-module-builder.js');
9
10 function toBytes(string) {
11 var a = new Array(string.length + 1);
12 a[0] = string.length;
13 for (i = 0; i < string.length; i++) {
14 a[i + 1] = string.charCodeAt(i);
15 }
16 return a;
17 }
18
19 (function TestEmptyNamesSection() {
20 print('TestEmptyNamesSection...');
21 var builder = new WasmModuleBuilder();
22
23 builder.addExplicitSection([kUnknownSectionCode, 6, ...toBytes('name'), 0]);
24
25 var buffer = builder.toBuffer();
26 assertTrue(WebAssembly.validate(buffer));
27 assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
28 })();
29
30 (function TestTruncatedNamesSection() {
31 print('TestTruncatedNamesSection...');
32 var builder = new WasmModuleBuilder();
33
34 builder.addExplicitSection([kUnknownSectionCode, 6, ...toBytes('name'), 1]);
35
36 var buffer = builder.toBuffer();
37 assertTrue(WebAssembly.validate(buffer));
38 assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
39 })();
40
41 (function TestBrokenNamesSection() {
42 print('TestBrokenNamesSection...');
43 var builder = new WasmModuleBuilder();
44
45 builder.addExplicitSection(
46 [kUnknownSectionCode, 7, ...toBytes('name'), 1, 100]);
47
48 var buffer = builder.toBuffer();
49 assertTrue(WebAssembly.validate(buffer));
50 assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
51 })();
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