diff options
| author | Eli Zaretskii | 2020-09-15 18:44:01 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-09-15 18:44:01 +0300 |
| commit | f4b4166e0075943641cd75c5935959cdc157c585 (patch) | |
| tree | dfcef54ba6efd27c1cb061419491ce7915b34d88 | |
| parent | 9bb9f4370950f9e8e043aa07bab9e9a54fb9d344 (diff) | |
| download | emacs-f4b4166e0075943641cd75c5935959cdc157c585.tar.gz emacs-f4b4166e0075943641cd75c5935959cdc157c585.zip | |
Avoid aborts in display_mode_element
* src/xdisp.c (display_mode_element): Use parse_str_as_multibyte,
not multibyte_chars_in_text, to determine whether mode-line spec
shall be displayed as a multibyte or unibyte string. We cannot
use multibyte_chars_in_text here because it aborts when it finds
raw bytes in the spec string. (Bug#43409)
| -rw-r--r-- | src/xdisp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 10ddb53dba2..615f0ca7cf8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -25641,8 +25641,10 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 25641 | /* Non-ASCII characters in SPEC should cause mode-line | 25641 | /* Non-ASCII characters in SPEC should cause mode-line |
| 25642 | element be displayed as a multibyte string. */ | 25642 | element be displayed as a multibyte string. */ |
| 25643 | ptrdiff_t nbytes = strlen (spec); | 25643 | ptrdiff_t nbytes = strlen (spec); |
| 25644 | if (multibyte_chars_in_text ((const unsigned char *)spec, | 25644 | ptrdiff_t nchars, mb_nbytes; |
| 25645 | nbytes) != nbytes) | 25645 | parse_str_as_multibyte ((const unsigned char *)spec, nbytes, |
| 25646 | &nchars, &mb_nbytes); | ||
| 25647 | if (!(nbytes == nchars || nbytes != mb_nbytes)) | ||
| 25646 | multibyte = true; | 25648 | multibyte = true; |
| 25647 | 25649 | ||
| 25648 | switch (mode_line_target) | 25650 | switch (mode_line_target) |