This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-10-quiet-head
in repository terminology.
View the commit online.
commit 1921a22a4c107c36249dfe5ad4198d3398dda57e
Author: [email protected] <[email protected]>
AuthorDate: Thu Sep 24 20:57:22 2026 -0600
termpty: fix hang when freeing a full hyperlink table
ty->hl.size is uint32_t and doubles in term_link_new() up to
HL_LINKS_MAX (65536) once more than 32768 hyperlink (OSC 8) ids are
live at once. The uint16_t counter in termpty_free() wraps from 65535
to 0 and never reaches 65536, so freeing such a terminal spins forever
and hangs Terminology. This happens when closing a tab/window with a
full hyperlink table, but is reachable on master by a program emitting
more than 32768 distinct live hyperlinks. The fix changes the loop
counter to uint32_t to avoid the wrap.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
src/bin/termpty.c | 31 +++++++++++++++++++++++++++++--
src/bin/tytest.c | 1 +
src/bin/unit_tests.h | 1 +
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 1d36dda4..680a38b0 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -907,7 +907,7 @@ termpty_free(Termpty *ty)
free(ty->screen2);
if (ty->hl.links)
{
- uint16_t i;
+ uint32_t i;
for (i = 0; i < ty->hl.size; i++)
{
@@ -915,7 +915,7 @@ termpty_free(Termpty *ty)
term_link_free(ty, l);
}
- free(ty->hl.links);
+ free(ty->hl.links);
}
free(ty->hl.bitmap);
free(ty->buf);
@@ -2438,6 +2438,33 @@ tytest_sync_change_cb_altscreen(void)
return 0;
}
+/* Grow ty->hl.size past 32768 so it reaches HL_LINKS_MAX (65536), then
+ * tear the pty down with termpty_free(). Uses a heap-allocated Termpty,
+ * since termpty_free() ends with free(ty). */
+int
+tytest_hl_links_free_full(void)
+{
+ Termpty *ty = calloc(1, sizeof(Termpty));
+ Config *config;
+ Term_Link *link;
+
+ assert(ty);
+ _ty_test_init(ty, 80, 24);
+
+ while (ty->hl.size < HL_LINKS_MAX)
+ {
+ link = term_link_new(ty);
+ assert(link);
+ }
+
+ config = ty->config;
+ termpty_free(ty);
+ config_del(config);
+ ecore_shutdown();
+ eina_shutdown();
+ return 0;
+}
+
/* Compare what was written back to the application, then drop it. */
static void
_ty_reply_is(Termpty *ty, const char *expected)
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index 7a84f24b..c1c43c7e 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -63,6 +63,7 @@ static struct {
{ "sync_change_cb_coalesced", tytest_sync_change_cb_coalesced},
{ "sync_change_cb_watchdog", tytest_sync_change_cb_watchdog},
{ "sync_change_cb_altscreen", tytest_sync_change_cb_altscreen},
+ { "hl_links_free_full", tytest_hl_links_free_full},
{ "percent_decode", tytest_percent_decode},
{ "sgr_58_no_leak", tytest_sgr_58_no_leak},
{ "xmodkeys_set", tytest_xmodkeys_set},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index 05fdff90..4a26dfc7 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -37,6 +37,7 @@ int tytest_sync_soft_reset(void);
int tytest_sync_change_cb_coalesced(void);
int tytest_sync_change_cb_watchdog(void);
int tytest_sync_change_cb_altscreen(void);
+int tytest_hl_links_free_full(void);
int tytest_percent_decode(void);
int tytest_sgr_58_no_leak(void);
int tytest_xmodkeys_set(void);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.