aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2026-06-24 11:06:16 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-06-24 11:06:16 +0000
commite24ad0a793819b12929fadba53725cf5ec3826ab (patch)
tree65e0efcff457a3bcce1020efeb388b9851f5f75e
parentcsi: kitty: limit pop count to the size of the flag stack (diff)
csi: clamp REP count to scrollback-lines * cols
This can be quite a lot, but hopefully less than 0x7fffffff, which is the max value a VT parameter can have... Closes #2366
-rw-r--r--csi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/csi.c b/csi.c
index ed643090..68825760 100644
--- a/csi.c
+++ b/csi.c
@@ -798,7 +798,8 @@ csi_dispatch(struct terminal *term, uint8_t final)
* ECMA-48, the behaviour is undefined if REP was
* _not_ preceded by a graphical character.
*/
- int count = vt_param_get(term, 0, 1);
+ const size_t max_count = term->grid->num_rows * term->cols;
+ int count = min(vt_param_get(term, 0, 1), max_count);
LOG_DBG("REP: '%lc' %d times", (wint_t)term->vt.last_printed, count);
int width;