From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 43409@debbugs.gnu.org
Subject: bug#43409: 28.0.50; Segfault on non-UTF-8 path
Date: Tue, 15 Sep 2020 17:15:06 +0300 [thread overview]
Message-ID: <834knz9led.fsf@gnu.org> (raw)
In-Reply-To: <m3sgbjyjvf.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue, 15 Sep 2020 02:16:36 +0200)
> From: Lars Ingebrigtsen <larsi@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@entry=6, backtrace_limit=backtrace_limit@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@entry=0x5555565f0870 "f\363o", nbytes=nbytes@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)
next prev parent reply other threads:[~2020-09-15 14:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 0:16 bug#43409: 28.0.50; Segfault on non-UTF-8 path Lars Ingebrigtsen
2020-09-15 14:15 ` Eli Zaretskii [this message]
2020-09-15 15:12 ` Lars Ingebrigtsen
2020-09-15 15:45 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=834knz9led.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=43409@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.