NAME=wasm crash test
FILE=bins/wasm/nullderef.wasm
CMDS=<<EOF
pd 10
EOF
EXPECT=<<EOF
            ;-- entry0:
            ;-- main:
            0x000000be      4185feff77     i32.const 251657989
            0x000000c3      fd0f           i8x16.splat
            0x000000c5      fda001         incorrect
            0x000000c8      fd64           incorrect
            0x000000ca      0b             end
            0x000000cb      ff             trap
            0x000000cc      ff             trap
            0x000000cd      ff             trap
            0x000000ce      ff             trap
            0x000000cf      ff             trap
EOF
EXPECT_ERR=
RUN

NAME=wasm gc recursive types and initializer immediates
FILE=hex://0061736d010000000110024e025e770160016300005f0164010003020101060c027f00410b0b630000d0000b070501016600000a040102000b
CMDS=<<EOF
iI~bintype
is~global
EOF
EXPECT=<<EOF
bintype  wasm
0   0x00000021 0x00000021 NONE   i32  4        global.0
1   0x00000026 0x00000026 NONE   REF  0        global.1
EOF
EXPECT_ERR=
RUN

NAME=wasm fuzzed leb128 virtual register profile crash
FILE=bins/fuzzed/r2_hbo_read_u32_leb128
CMDS=<<EOF
arp~l
dr l15
dr l15=0
dr l15
arpi~l15~?
EOF
EXPECT=<<EOF
gpr	l[1024]	.32	$	0
0x00000000
0x00000000
1
EOF
EXPECT_ERR=<<EOF
ERROR: beach sections
EOF
RUN

NAME=wasm fuzzed init expr virtual register profile crash
FILE=bins/fuzzed/r2_hoobr_consume_init_expr
CMDS=<<EOF
arp~l
dr l15
dr l15=0
dr l15
arpi~l15~?
EOF
EXPECT=<<EOF
gpr	l[1024]	.32	$	0
0x00000000
0x00000000
1
EOF
EXPECT_ERR=<<EOF
ERROR: unknown section id: 48
ERROR: unknown section id: 48
ERROR: unknown section id: 48
ERROR: unknown section id: 48
INFO: Artificially reducing size of section data by 0x2f bytes so it fits in the file
ERROR: Failed to parse entry 0/48 of vec at 0xb0
EOF
RUN
