mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-22 19:56:08 +03:00

Fixes a crash found through fuzzing. This crash is also exhibited in xterm (as of v384). The issue arises when you set the cursor above the top scroll margin, then issue a large cursor left (CSI D) with extended reverse wrap (?1045) set. Extended reverse wrap loops back until it reaches the top scroll then wraps around. But since the cursor is before the top scroll, xterm just arbitrarily moves back into negative row numbers, which reads into bad memory. We decided to fix this by clamping to (0,0) and exiting because this will mimic the xterm behavior for valid values of cursor left count (prior to crashing).