[jiterp] Perform a single unsigned bounds check for ldelema1 (#82919)
authorKatelyn Gadd <kg@luminance.org>
Fri, 3 Mar 2023 09:40:06 +0000 (01:40 -0800)
committerGitHub <noreply@github.com>
Fri, 3 Mar 2023 09:40:06 +0000 (01:40 -0800)
commit5770b4185772e84ad0392b724d59762bdeec15fd
treef7a79086996da2b4dfc31f33ee2d2b9fbe6c996b
parent9fe0fc8b03ebbdb05377a6cd9fe7ca0d3a703450
[jiterp] Perform a single unsigned bounds check for ldelema1 (#82919)

Array and Span both have a uint32_t length field (at least as far as wasm is concerned). If index is signed and we do an unsigned index <= length then any negative index will be treated as a massive value. For arrays it appears to be safe to exploit this and not do the >= 0 check, and interp.c doesn't do it.
src/mono/wasm/runtime/jiterpreter-trace-generator.ts