Skip to content

Commit 16fed05

Browse files
committed
Avoid crashes on TTY frames with over-long compositions
* 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)
1 parent 0278741 commit 16fed05

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/term.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ encode_terminal_code (struct glyph *src, int src_len,
563563
{
564564
cmp = composition_table[src->u.cmp.id];
565565
required = cmp->glyph_len;
566-
required *= MAX_MULTIBYTE_LENGTH;
567566
}
567+
required *= MAX_MULTIBYTE_LENGTH;
568568

569569
if (encode_terminal_src_size - nbytes < required)
570570
{

0 commit comments

Comments
 (0)