Fix off-by-one in assert_no_overlap boundary check by sumleo · Pull Request #12678 · bytecodealliance/wasmtime

@sumleo

The assert_no_overlap function used strict less-than (<) comparisons
to check if two memory regions overlap. This incorrectly rejected
adjacent non-overlapping regions where one region's end address
equals another region's start address. Changed to less-than-or-equal
(<=) to correctly allow adjacent regions.

Added comprehensive tests covering separate regions, adjacent regions,
mixed types, overlap detection, and edge cases.

alexcrichton

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request

Mar 30, 2026
Fixes an off-by-one assertion which is possible to happen when linear
memories are directly adjacent to each other. While an esoteric
situation, it's technically possible as the added test shows.

Closes bytecodealliance#12678

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request

Mar 30, 2026
Fixes an off-by-one assertion which is possible to happen when linear
memories are directly adjacent to each other. While an esoteric
situation, it's technically possible as the added test shows.

Closes bytecodealliance#12678

github-merge-queue bot pushed a commit that referenced this pull request

Mar 31, 2026
Fixes an off-by-one assertion which is possible to happen when linear
memories are directly adjacent to each other. While an esoteric
situation, it's technically possible as the added test shows.

Closes #12678