wabt
5c48f3bd - Fix address overflow bug in wasm2c (#1401)

Commit
5 years ago
Fix address overflow bug in wasm2c (#1401) This only occurs when the immediate offset is small (`int` sized). The stack offset is `u32` and the immediate is an `int`, so the usual arithmetic conversions converts the result to a `u32`, which wraps the address before checking for overflow. There are already spec tests for overflow, but these use an offset of `4294967295`, which is `long` (at least on LP64 systems). This means that the sum's type is `u32 + long` which is `long`. This is why the tests pass. I've added additional tests for these cases here: https://github.com/WebAssembly/spec/pull/1188 This fixes issue #1400.
Author
Parents
Loading