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

Unified Diff: test/mjsunit/wasm/import-memory.js

Issue 2636173002: [wasm] Enforce memory and table limits during instantiation. (Closed)
Patch Set: [wasm] Enforce memory and table limits during instantiation. 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 | « test/mjsunit/wasm/compiled-module-serialization.js ('k') | test/mjsunit/wasm/indirect-tables.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/import-memory.js
diff --git a/test/mjsunit/wasm/import-memory.js b/test/mjsunit/wasm/import-memory.js
index fd91dc0f7292ba93cf697315d5b0d15b39e4a3f3..96317b7f640c7ae6d34ef82cc16169465fcb745a 100644
--- a/test/mjsunit/wasm/import-memory.js
+++ b/test/mjsunit/wasm/import-memory.js
@@ -382,3 +382,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertEquals(3, instance.exports.mem_size());
assertEquals(3*kPageSize, instance.exports.exported_mem.buffer.byteLength);
})();
+
+(function TestImportTooLarge() {
+ print("TestImportTooLarge");
+ let builder = new WasmModuleBuilder();
+ builder.addImportedMemory("m", "m", 1, 2);
+
+ // initial size is too large
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 3, maximum: 3})}}));
+
+ // maximum size is too large
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 1, maximum: 4})}}));
+
+ // no maximum
+ assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 1})}}));
+})();
« no previous file with comments | « test/mjsunit/wasm/compiled-module-serialization.js ('k') | test/mjsunit/wasm/indirect-tables.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698