]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid crashes on TTY frames with over-long compositions
authorEli Zaretskii <eliz@gnu.org>
Tue, 28 Apr 2020 08:57:16 +0000 (11:57 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 28 Apr 2020 08:57:16 +0000 (11:57 +0300)
* src/term.c (encode_terminal_code): Each character from an
automatic composition is a multibyte character, so its multibyte
representation can take up to MAX_MULTIBYTE_LENGTH bytes.
Account for that when allocating storage for characters to be
encoded.  (Bug#40913)

src/term.c

index a3aef31ec25d1c12b5c20151e87f9c6d71ca5bc9..94bf013f4a0728936c3b018cd9886c7982068f4e 100644 (file)
@@ -563,8 +563,8 @@ encode_terminal_code (struct glyph *src, int src_len,
            {
              cmp = composition_table[src->u.cmp.id];
              required = cmp->glyph_len;
-             required *= MAX_MULTIBYTE_LENGTH;
            }
+         required *= MAX_MULTIBYTE_LENGTH;
 
          if (encode_terminal_src_size - nbytes < required)
            {