summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/regress/oom-wrong-argument-number-for-import-call.js
blob: d4eb2da5a304c5fd2a53dcc636b1720a110e8c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function f() {
  // Too many results returned.
  return [52, 10, 0, 0];
}

let binary = wasmTextToBinary(`
  (module
    (import "env" "f" (func $f (result i32 i32 i32)))
    (func (export "run") (result i32)
      (call $f)
      i32.sub
      i32.sub))
`);

let module = new WebAssembly.Module(binary);
let instance = new WebAssembly.Instance(module, { env: { f } });
let run = instance.exports.run;

// Run once for setup.
try { run(); } catch {}

oomTest(run);