Progress and a tiny WASM binary parser

This commit is contained in:
dcodeIO
2018-04-03 23:56:48 +02:00
parent 06198a3723
commit 5823e35f37
58 changed files with 12075 additions and 3964 deletions

View File

@ -1,4 +1,5 @@
const fs = require("fs");
const COMMON_MAX = 1 << 30;
function test(file) {
console.log("Testing '" + file + "' ...\n");
@ -23,6 +24,13 @@ function test(file) {
console.log("mem final: " + exports.memory.buffer.byteLength);
console.log();
if (exports.allocate_memory(COMMON_MAX + 1) != 0) {
throw Error("allocation is allowed to overflow MAX_SIZE");
}
if (exports.allocate_memory(0xffffffff) != 0) {
throw Error("allocation is allowed to overflow INT_MAX");
}
}
if (process.argv.length > 2) {