From afb95f3134567888c03bc45136ac2d6d5dcfd9cc Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 26 Jul 2026 09:02:08 +0000 Subject: [PATCH 1/3] Do not loop forever if the combining character is too long, GitHub issue 5434 from me at qdrs dot dev. --- screen-write.c | 4 ++-- tty-draw.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/screen-write.c b/screen-write.c index 1ba5bed70..6cfc80ad0 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.284 2026/07/20 11:16:33 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.285 2026/07/26 09:02:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2783,7 +2783,7 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc) /* Check if this combined character would be too long. */ if (last.data.size + ud->size > sizeof last.data.data) - return (0); + return (zero_width); /* Combining; flush any pending output. */ screen_write_collect_flush(ctx, 0, __func__); diff --git a/tty-draw.c b/tty-draw.c index d47be66bc..06d520e11 100644 --- a/tty-draw.c +++ b/tty-draw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-draw.c,v 1.14 2026/06/19 10:38:29 nicm Exp $ */ +/* $OpenBSD: tty-draw.c,v 1.15 2026/07/26 09:02:08 nicm Exp $ */ /* * Copyright (c) 2026 Nicholas Marriott @@ -100,6 +100,8 @@ tty_draw_line_get_empty(const struct grid_cell *gc, empty = nx; else if (gc->flags & GRID_FLAG_PADDING) empty = 1; + else if (gc->data.width == 0) + empty = 1; else if (gc->flags & GRID_FLAG_SELECTED) empty = 0; else if (gc->bg == last->bg && gc->attr == 0 && gc->link == 0) { From 55169f12756175d526d7254c53d1701db98e47df Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 26 Jul 2026 09:17:30 +0000 Subject: [PATCH 2/3] Reset title count when freeing titles, GitHub issue 5429 from Brett Smith. --- screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/screen.c b/screen.c index 4c754360c..35f26bfa6 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.105 2026/06/29 18:17:28 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.106 2026/07/26 09:17:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -70,6 +70,7 @@ screen_free_titles(struct screen *s) free(s->titles); s->titles = NULL; + s->ntitles = 0; } /* Create a new screen. */ From 3068ae06a88269072affc21e9c6e2cb62246905c Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 26 Jul 2026 09:20:54 +0000 Subject: [PATCH 3/3] Also set ntitles to 0 when creating screen in the first place. --- screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/screen.c b/screen.c index 35f26bfa6..2533beb5c 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.106 2026/07/26 09:17:30 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.107 2026/07/26 09:20:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -82,6 +82,7 @@ screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit) s->title = xstrdup(""); s->titles = NULL; + s->ntitles = 0; s->path = NULL; s->cstyle = SCREEN_CURSOR_DEFAULT;