Out of bounds WASM memory access for >2GB addresses
The ABI stack machine treats everything as i32s, which is ok if we just pass values on. However, when reading or writing addresses and lengths and offsets, this has created a huge footgun. I found out that when returning a list from a WASM component that's allocated at an address >2GB, i.e. where the address in i32 form is negative, the component layer then converts it to a usize with an as cast, transforming it into a huge 64bit value that is out of bounds when reading from the WASM memory.
Here's the start of a local patch on my fork: https://github.com/juntyr/wasm_component_layer/commit/8e82d9d8dbeaf15e844b66bd5d5999b1b0836874
But there's probably more places and cases where casting i32's is wrong (list lengths and memory offsets look similarly suspicious but I don't have the time right now to investigate further).