Skip to content

Misc runtime safety fixes - #13275

Merged
mitchellh merged 3 commits into
mainfrom
misc-fixes
Jul 10, 2026
Merged

mitchellh merged 3 commits into
mainfrom
misc-fixes

Conversation

@mitchellh

@mitchellh mitchellh commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Runtime safety violating scenarios found by GPT 5.6. Verified each one manually. See each commit.

I'm going to keep searching so not going to merge this yet.

mitchellh added 3 commits July 9, 2026 19:55
Low-level search state accepted an empty needle even though the search
thread normally filters it out. SlidingWindow treated the empty string
as a zero-length match and underflowed while calculating its inclusive
end offset. Active and viewport overlap calculations could also
underflow while loading adjacent pages.

Treat an empty needle as an inactive search with no matches or history,
and saturate the viewport overlap length.
Pin.leftWrap and rightWrap calculated the destination using the
remainder after consuming the current row. When that remainder was an
exact multiple of the column count, rightWrap subtracted one from zero
and leftWrap produced a column equal to the width. Dereferencing either
pin could panic. A maximum usize offset on a one-column page also
overflowed the row count.

Base the row and column calculations on the remainder minus one. This
maps exact multiples to the final cell of the correct row and keeps the
maximum offset calculation in range so traversal reports overflow
normally.
setCursorPos added origin-mode margins to requested row and column
values before clamping them to the scrolling region. A request near
maxInt(usize) overflowed during that addition and crashed instead of
landing on the region boundary.

Use saturating addition for the origin offsets. The existing clamp then
places oversized requests on the bottom-right margin without changing
normal cursor positioning.
@mitchellh mitchellh added this to the 1.4.0 milestone Jul 10, 2026
@mitchellh
mitchellh requested a review from a team as a code owner July 10, 2026 02:57
@mitchellh

Copy link
Copy Markdown
Contributor Author

Nvm GPT shut me down for cybersecurity blocks. YO.

@mitchellh
mitchellh merged commit 6236d38 into main Jul 10, 2026
108 checks passed
@mitchellh
mitchellh deleted the misc-fixes branch July 10, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant