Do not allow combined UTF-8 characters that are too long, GitHub issue
authornicm <nicm@openbsd.org>
Mon, 30 Oct 2023 16:05:30 +0000 (16:05 +0000)
committernicm <nicm@openbsd.org>
Mon, 30 Oct 2023 16:05:30 +0000 (16:05 +0000)
3729.

usr.bin/tmux/screen-write.c

index 45b36c8..71b7f99 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.223 2023/10/23 08:12:00 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.224 2023/10/30 16:05:30 nicm Exp $ */
 
 /*
  * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2025,6 +2025,10 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
                        return (0);
        }
 
+       /* Check if this combined character would be too long. */
+       if (last.data.size + ud->size > sizeof last.data.data)
+               return (0);
+
        /* Combining; flush any pending output. */
        screen_write_collect_flush(ctx, 0, __func__);