diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2023-03-28 16:31:24 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2023-03-30 14:13:18 +0000 |
| commit | 7bc22862fa9536cb2f18b030209a95306e57360d (patch) | |
| tree | 545c0dd74f435f15468f5dd18539859dcbb6bb21 /terminal.c | |
| parent | input: (kitty kbd): the resulting UTF-8 string may translate to multiple UTF-32 codepoints (diff) | |
render: protect against integer underflow when calculating scroll area
When applying scroll damage, we calculate the affected region’s
height (in pixels), by subtracting the number of rows to scroll, from
the scrolling region, and finally multiply by the cell height.
If the number of rows to scroll is very large, the subtraction may
underflow, resulting in a very large height value instead of a
negative one.
This caused the check for "scrolling too many lines" to fail. That in
turn resulted in an integer overflow when calculating the source
offset into the rendered surface buffer, which typically triggered a
segfault.
This bug happened when there was continuous output in the terminal
without any new frames being rendered. This caused a buildup of scroll
damage, that triggered the underflow+overflow when we finally did
render a new frame.
For example, a compositor that doesn’t send any frame callbacks (for
example because the terminal window is minimized, or on a different
workspace/tag) would cause this.
Closes #1305
Diffstat (limited to 'terminal.c')
0 files changed, 0 insertions, 0 deletions
