GNU bug report logs -
#43409
28.0.50; Segfault on non-UTF-8 path
Previous Next
Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>
Date: Tue, 15 Sep 2020 00:17:01 UTC
Severity: normal
Found in version 28.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 15 Sep 2020 02:16:36 +0200
>
> Hitting RET on that kills Emacs. Running under gdb, I get this
> backtrace:
>
> #0 terminate_due_to_signal
> (sig=sig <at> entry=6, backtrace_limit=backtrace_limit <at> entry=40) at emacs.c:378
> #1 0x00005555555984fe in emacs_abort () at sysdep.c:2280
> #2 0x0000555555596a9a in multibyte_chars_in_text (ptr=<optimized out>,
> ptr <at> entry=0x5555565f0870 "f\363o", nbytes=nbytes <at> entry=3)
> at character.c:447
> #3 0x00005555555d412b in display_mode_element
> (it=<optimized out>, depth=<optimized out>, field_width=<optimized out>, precision=<optimized out>, elt=<optimized out>, props=<optimized out>, risky=<optimized out>) at xdisp.c:25644
My bad, sorry: I used a wrong API for the job. Does the below solve
the problem?
diff --git a/src/xdisp.c b/src/xdisp.c
index 10ddb53dba..615f0ca7cf 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,
/* 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)
This bug report was last modified 4 years and 310 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.