[PR #17361] Support valid out-of-bounds access in utextAccess #31198

Open
opened 2026-01-31 09:45:45 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17361

State: closed
Merged: Yes


utextAccess apparently doesn't actually need to clamp the
chunkOffset to be in range of the current chunk. Also, I missed to
implement the part of the spec that says to leave the iterator on the
first/last chunk of the UText in case of an out-of-bounds index.

This PR fixes the issue by simply not returning early, doing a more
liberal clamp of the offset, and then checking whether it was in range.

As an aside, this also fixes a one-off bug when hovering URLs that
end on the very last cell of the viewport (or are cut off).

Closes #17343

Validation Steps Performed

  • Write an URL that wraps across the last 2 lines in the buffer
  • Scroll 1 line up
  • No assert
  • Hovering the URL shows the full, still visible parts of the URL
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17361 **State:** closed **Merged:** Yes --- `utextAccess` apparently doesn't actually need to clamp the `chunkOffset` to be in range of the current chunk. Also, I missed to implement the part of the spec that says to leave the iterator on the first/last chunk of the `UText` in case of an out-of-bounds index. This PR fixes the issue by simply not returning early, doing a more liberal clamp of the offset, and then checking whether it was in range. As an aside, this also fixes a one-off bug when hovering URLs that end on the very last cell of the viewport (or are cut off). Closes #17343 ## Validation Steps Performed * Write an URL that wraps across the last 2 lines in the buffer * Scroll 1 line up * No assert ✅ * Hovering the URL shows the full, still visible parts of the URL ✅
claunia added the pull-request label 2026-01-31 09:45:45 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31198