aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-01-18 09:22:24 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-01-18 09:22:24 +0000
commit22e1b1610f622ca9e2a7e64593025a8d44bc7b14 (patch)
tree854d8c52c872f06cc85f59dde5ee33940caf2f6f
parentMerge branch 'releases/1.20' (diff)
vt: combining chars: ensure 'key' is within range
When there's a key collision, we increment the key and check again. When doing this, we need to ensure the key is withing range, and wrap around to 0 if the key value is too large.
-rw-r--r--vt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vt.c b/vt.c
index 95cfdd2e..2b5eb27d 100644
--- a/vt.c
+++ b/vt.c
@@ -845,6 +845,7 @@ action_utf8_print(struct terminal *term, char32_t wc)
cc->chars[0], base, cc->count, wanted_count, cc->chars[wanted_count - 1], wc);
#endif
key++;
+ key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
collision_count++;
continue;
}
@@ -856,6 +857,7 @@ action_utf8_print(struct terminal *term, char32_t wc)
if (!match) {
key++;
+ key &= CELL_COMB_CHARS_HI - CELL_COMB_CHARS_LO;
collision_count++;
continue;
}