Don't access memory outside of the binary's range
Fix build with riscv-gcc version 4.9