diff options
| author | Eli Zaretskii | 2020-04-28 11:57:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-04-28 11:57:16 +0300 |
| commit | 16fed05ba85c3d92d3c913657dd50a648ad3884a (patch) | |
| tree | d4dda280f6949d3f1ae169bc533ec81e4c9c18cd /src | |
| parent | 0278741676e2eca89ecf085344be6bc4fd586396 (diff) | |
| download | emacs-16fed05ba85c3d92d3c913657dd50a648ad3884a.tar.gz emacs-16fed05ba85c3d92d3c913657dd50a648ad3884a.zip | |
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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/term.c b/src/term.c index a3aef31ec25..94bf013f4a0 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -563,8 +563,8 @@ encode_terminal_code (struct glyph *src, int src_len, | |||
| 563 | { | 563 | { |
| 564 | cmp = composition_table[src->u.cmp.id]; | 564 | cmp = composition_table[src->u.cmp.id]; |
| 565 | required = cmp->glyph_len; | 565 | required = cmp->glyph_len; |
| 566 | required *= MAX_MULTIBYTE_LENGTH; | ||
| 567 | } | 566 | } |
| 567 | required *= MAX_MULTIBYTE_LENGTH; | ||
| 568 | 568 | ||
| 569 | if (encode_terminal_src_size - nbytes < required) | 569 | if (encode_terminal_src_size - nbytes < required) |
| 570 | { | 570 | { |