> wasmtime test.wasm 07/08/2023 04:20:37 PM
Error: failed to run main module `test.wasm`
Caused by:
0: failed to invoke command default
1: error while executing at wasm backtrace:
0: 0xd4 - _start
at /Users/luuk/dev/zig-dev/foo.zig:6:5
2: wasm trap: out of bounds memory access
This is due to Wasm's memory.copy instruction trapping when the source -or destination address is out-of-bounds regardless of the length operand.
Expected Behavior
I expected zero-length memset/memcpy to result in a no-op and not trap.
Zig Version
0.11.0-dev.3947+89396ff02
Steps to Reproduce and Observed Behavior
Given the following program and CLI input:
results in a program that traps:
This is due to Wasm's
memory.copy
instruction trapping when the source -or destination address is out-of-bounds regardless of the length operand.Expected Behavior
I expected zero-length memset/memcpy to result in a no-op and not trap.