1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-30 09:00:31 -08:00

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)
This commit is contained in:
Eli Zaretskii 2020-09-15 18:44:01 +03:00
parent 9bb9f43709
commit f4b4166e00

View file

@ -25641,8 +25641,10 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
/* Non-ASCII characters in SPEC should cause mode-line
element be displayed as a multibyte string. */
ptrdiff_t nbytes = strlen (spec);
if (multibyte_chars_in_text ((const unsigned char *)spec,
nbytes) != nbytes)
ptrdiff_t nchars, mb_nbytes;
parse_str_as_multibyte ((const unsigned char *)spec, nbytes,
&nchars, &mb_nbytes);
if (!(nbytes == nchars || nbytes != mb_nbytes))
multibyte = true;
switch (mode_line_target)