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

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

Issue 2288773002: [wasm] Check the input of grow-memory before calling the runtime. (Closed)
Patch Set: Comments. Created 4 years, 4 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/runtime/runtime-wasm.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/grow-memory.js
diff --git a/test/mjsunit/wasm/grow-memory.js b/test/mjsunit/wasm/grow-memory.js
index 27aca22d1a68060dc3ea95371046cbe5be9cbf4f..473760fc3d1c2601cbc9274f6692762902b01798 100644
--- a/test/mjsunit/wasm/grow-memory.js
+++ b/test/mjsunit/wasm/grow-memory.js
@@ -117,3 +117,14 @@ function testGrowMemoryTrapMaxPages() {
}
testGrowMemoryTrapMaxPages();
+
+function testGrowMemoryTrapsWithNonSmiInput() {
+ var builder = genGrowMemoryBuilder();
+ var module = builder.instantiate();
+ function growMem(pages) { return module.exports.grow_memory(pages); }
+ // The parameter of grow_memory is unsigned. Therefore -1 stands for
+ // UINT32_MIN, which cannot be represented as SMI.
+ assertEquals(-1, growMem(-1));
+};
+
+testGrowMemoryTrapsWithNonSmiInput();
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698