node/test/es-module/test-wasm-memory-out-of-bound.js
Geoffrey Booth 85301803e1
esm: --experimental-default-type flag to flip module defaults
PR-URL: https://github.com/nodejs/node/pull/49869
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-09-29 06:18:44 +00:00

13 lines
393 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');
const buffer = fixtures.readSync('out-of-bound.wasm');
WebAssembly.instantiate(buffer, {}).then(common.mustCall((results) => {
assert.throws(() => {
results.instance.exports._start();
}, WebAssembly.RuntimeError('memory access out of bounds'));
}));