GNU bug report logs - #24206
25.1; Curly quotes generate invalid strings, leading to a segfault

Previous Next

Package: emacs;

Reported by: Phil <p.stephani2 <at> gmail.com>

Date: Thu, 11 Aug 2016 18:57:02 UTC

Severity: normal

Found in version 25.1

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: p.stephani2 <at> gmail.com, eggert <at> cs.ucla.edu, nicolas <at> petton.fr, johnw <at> gnu.org, 24206 <at> debbugs.gnu.org
Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault
Date: Mon, 15 Aug 2016 21:51:37 +0300
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>,  p.stephani2 <at> gmail.com,  johnw <at> gnu.org,  nicolas <at> petton.fr,  24206 <at> debbugs.gnu.org
> Date: Mon, 15 Aug 2016 18:46:19 +0200
> 
> Unibyte strings should not be used for anything but pre-decoding /
> post-encoding situations directly after / before doing the actual I/O
> operation.  Thus substitute-command-keys should never be called with an
> undecoded unibyte string.  IMHO it would be ok to return something
> useless in this case (but it shouldn't cause Emacs to crash, of course).

I mostly agree, but there's one situation where the above cannot hold:
during startup, before Emacs sets up its encoding/decoding machinery
and defaults, and decodes the relevant variables (such as load-path)
after that.  Until that is done, we cannot have multibyte strings in
Emacs, because we don't know how to decode them.  During that short
period, Emacs still calls various primitives that manipulate strings,
and they need to work with unibyte strings, because Emacs must be able
to start up in directories with non-ASCII names.

Granted, substitute-command-keys are not supposed to be called during
that period.  Or at least I think so.  But who knows?  We definitely
call it when we construct the menu-bar menus, and some user could
perhaps cause it to be called in some startup hook.

So I'm okay with changing the output for unibyte strings on master,
but I think emacs-25 should not produce multibyte strings from
substitute-command-keys more eagerly than previous versions.




This bug report was last modified 8 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.