Open beaumccartney opened 1 month ago
also using memcmp from libc or something doesn't crash
In runtime.memory_compare_zero
fast := n/SU + 1
This way of calculating fast
looks to be an off-by-one error when considering this comparison loop.
curr_block := uintptr(0)
// ...
for /**/; curr_block < fast; curr_block += 1 {
va := (^uintptr)(x + curr_block * size_of(uintptr))^
// ...
At the last iteration, curr_block
would get 2048
on Darwin ARM64
.
I think there are also alignment issues with this as well since x
could've been an unaligned pointer.
using either of the procedures on memory i've mapped myself crashes after trying to dereference just after the last mapped byte (i.e. not valid address space).
Odin Report:
repro: