[PR #4964] Clamp the terminal buffer to SHRT_MAX on resize #26064

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

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

State: closed
Merged: Yes


Summary of the Pull Request

This is 100% on me. Even after mucking around in this function for the last 3
months, I missed that there was a single addition where we weren't doing a
clamped addition. This would lead to us creating a buffer with negative height,
and all sorts of badness.

Clamping this addition was enough to fix the bug.

PR Checklist

Validation Steps Performed

  • ran tests
  • Created a profile with "historySize" : 32728, then filled the viewport with
    text, then maximized, and saw that the viewport indeed did resize to the new
    size of the window.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/4964 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request This is 100% on me. Even after mucking around in this function for the last 3 months, I missed that there was a single addition where we weren't doing a clamped addition. This would lead to us creating a buffer with negative height, and all sorts of badness. Clamping this addition was enough to fix the bug. ## PR Checklist * [x] Closes #2815 * [x] Closes #4972 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed * ran tests * Created a profile with `"historySize" : 32728`, then filled the viewport with text, then maximized, and saw that the viewport indeed did resize to the new size of the window.
claunia added the pull-request label 2026-01-31 09:13:41 +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#26064