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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/names.js
diff --git a/test/mjsunit/wasm/names.js b/test/mjsunit/wasm/names.js
new file mode 100644
index 0000000000000000000000000000000000000000..8b635e67713b284695189635e199c446f9e67310
--- /dev/null
+++ b/test/mjsunit/wasm/names.js
@@ -0,0 +1,51 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+function toBytes(string) {
+ var a = new Array(string.length + 1);
+ a[0] = string.length;
+ for (i = 0; i < string.length; i++) {
+ a[i + 1] = string.charCodeAt(i);
+ }
+ return a;
+}
+
+(function TestEmptyNamesSection() {
+ print('TestEmptyNamesSection...');
+ var builder = new WasmModuleBuilder();
+
+ builder.addExplicitSection([kUnknownSectionCode, 6, ...toBytes('name'), 0]);
+
+ var buffer = builder.toBuffer();
+ assertTrue(WebAssembly.validate(buffer));
+ assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
+})();
+
+(function TestTruncatedNamesSection() {
+ print('TestTruncatedNamesSection...');
+ var builder = new WasmModuleBuilder();
+
+ builder.addExplicitSection([kUnknownSectionCode, 6, ...toBytes('name'), 1]);
+
+ var buffer = builder.toBuffer();
+ assertTrue(WebAssembly.validate(buffer));
+ assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
+})();
+
+(function TestBrokenNamesSection() {
+ print('TestBrokenNamesSection...');
+ var builder = new WasmModuleBuilder();
+
+ builder.addExplicitSection(
+ [kUnknownSectionCode, 7, ...toBytes('name'), 1, 100]);
+
+ var buffer = builder.toBuffer();
+ assertTrue(WebAssembly.validate(buffer));
+ assertTrue((new WebAssembly.Module(buffer)) instanceof WebAssembly.Module);
+})();
« 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