sumleo requested fitzgen for a review on PR #12678.
sumleo opened PR #12678 from sumleo:fix/assert-no-overlap-off-by-one to bytecodealliance:main:
Summary
- Fixed boundary comparison in
assert_no_overlapusing<=instead of<- Adjacent non-overlapping memory regions were incorrectly triggering the overlap assertion
- Added 8 comprehensive tests for boundary conditions
Details
The
assert_no_overlapfunction in component model string transcoding used strict
less-than (<) to compare region boundaries. When two memory regions are adjacent
(e.g., region A ends at address 100, region B starts at address 100), the strict
comparison incorrectly identified them as overlapping, causing a panic.The fix changes both boundary checks from
<to<=, correctly allowing adjacent
non-overlapping regions while still detecting actual overlaps.Test plan
- [x] Added unit tests for separate, adjacent, and overlapping regions
- [x] Added tests for mixed types (u8/u16) and empty slices
- [x] Verified overlap detection still works (should_panic tests)
- [x] All existing tests pass
sumleo requested wasmtime-core-reviewers for a review on PR #12678.
github-actions[bot] added the label wasmtime:api on PR #12678.
alexcrichton submitted PR review:
Is this something that you encountered in practice? This looks like it was LLM-discovered and LLM-authored otherwise, and I'm not aware of a way for this to actually ever be a problem in practice. This seems reasonable to me to fix but I would say that the tests can be dropped here given the non-load-bearing nature of this function.
Last updated: Mar 23 2026 at 16:19 UTC