wazevo: fuzz, fix load_splat with offset values > 12 bits (#1817)

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
This commit is contained in:
Edoardo Vacchi
2023-10-25 17:33:57 +02:00
committed by GitHub
parent e3e5b9942d
commit a5d1b12385
5 changed files with 47 additions and 14 deletions

View File

@@ -647,3 +647,22 @@ func Test1812(t *testing.T) {
}, res)
})
}
// Test1817 tests that v128.store uses the right memory layout.
func Test1817(t *testing.T) {
if !platform.CompilerSupported() {
return
}
run(t, func(t *testing.T, r wazero.Runtime) {
mod, err := r.Instantiate(ctx, getWasmBinary(t, "1817"))
require.NoError(t, err)
m := mod.(*wasm.ModuleInstance)
_, err = m.ExportedFunction("").Call(ctx)
require.NoError(t, err)
buf, ok := m.Memory().Read(15616, 16)
require.True(t, ok)
require.Equal(t, []uint8{0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, buf)
require.Equal(t, uint64(0x8000000080000000), m.Globals[0].Val)
require.Equal(t, uint64(0x8000000080000000), m.Globals[0].ValHi)
})
}