Skip to content

Commit

Permalink
wazevo(amd64). fuzz: sigsegv
Browse files Browse the repository at this point in the history
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
  • Loading branch information
evacchi committed Feb 11, 2024
1 parent 2560f84 commit 94f9628
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/integration_test/fuzzcases/fuzzcases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,3 +986,15 @@ func Test2037(t *testing.T) {
require.Equal(t, []uint64{0x0, 0x0, 0xbbbbbbbbbbbbbbbb, 0xbbbbbbbbbbbbbbbb, 0xcb6151c8d497b060, 0xbbbbbbbbbbbbbbbb, 0xe71c3971a22b233b, 0xa0a0a0a0a0a0a0a, 0x0, 0xfffffffb00000030, 0x0, 0x6c6cbbbbbbbbbbbb, 0xfeb44590ef194fa2, 0x1313131313131313, 0x1898a98e9daf4f22, 0xf8f8f8f80a0a0aa0, 0x6c6c6c6c6c6cf1f8, 0x6c6c6c6c6c6c6c6c, 0x9abbbbbbbbbbbb6c, 0x9a9ad39a9a9a9a9a}, res)
})
}

func TestCrash(t *testing.T) {
if !platform.CompilerSupported() {
return
}
run(t, func(t *testing.T, r wazero.Runtime) {
mod, err := r.Instantiate(ctx, getWasmBinary(t, "crash"))
require.NoError(t, err)
_, err = mod.ExportedFunction("").Call(ctx, make([]uint64, 1)...)
require.NoError(t, err)
})
}
Binary file not shown.
25 changes: 25 additions & 0 deletions internal/integration_test/fuzzcases/testdata/crash.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(module
(type (;0;) (func (param i32)))
(func (;0;) (type 0) (param i32)
(local f32)
i32.const 988345840
f32.convert_i32_s
global.get 0
f32.max
local.tee 1
f32.const nan (;=nan;)
local.get 1
local.get 1
f32.eq
select
i32.reinterpret_f32
global.get 1
i32.xor
global.set 1)
(global (;0;) f32 (f32.const 0x1.c8c8c8p+73 (;=1.68524e+22;)))
(global (;1;) (mut i32) (i32.const 0))
(global (;2;) (mut i32) (i32.const 1000))
(export "" (func 0))
(export "1" (global 0))
(export "2" (global 1))
(data (;0;) ""))

0 comments on commit 94f9628

Please sign in to comment.