summaryrefslogtreecommitdiff
path: root/cli/tests/wasm_unreachable.js
blob: 991ebcec8564037cf7f29f047ccf3a610de79e73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// WebAssembly module containing a single function with an unreachable instruction
const binary = Uint8Array.from([
  0x00,
  0x61,
  0x73,
  0x6d,
  0x01,
  0x00,
  0x00,
  0x00,
  0x01,
  0x04,
  0x01,
  0x60,
  0x00,
  0x00,
  0x03,
  0x02,
  0x01,
  0x00,
  0x07,
  0x0f,
  0x01,
  0x0b,
  0x75,
  0x6e,
  0x72,
  0x65,
  0x61,
  0x63,
  0x68,
  0x61,
  0x62,
  0x6c,
  0x65,
  0x00,
  0x00,
  0x0a,
  0x05,
  0x01,
  0x03,
  0x00,
  0x00,
  0x0b,
]);

const module = new WebAssembly.Module(binary);
const instance = new WebAssembly.Instance(module);

instance.exports.unreachable();