all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: p.stephani2@gmail.com, johnw@gnu.org, nicolas@petton.fr,
	24206@debbugs.gnu.org
Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault
Date: Sun, 14 Aug 2016 17:27:14 +0300	[thread overview]
Message-ID: <8337m7h1dp.fsf@gnu.org> (raw)
In-Reply-To: <f1b9c0f6-39e3-2237-8f52-cc50805efbfb@cs.ucla.edu> (message from Paul Eggert on Sat, 13 Aug 2016 23:54:43 -0500)

> Cc: 24206-done@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
>  John Wiegley <johnw@gnu.org>, Nicolas Petton <nicolas@petton.fr>
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 13 Aug 2016 23:54:43 -0500
> 
> Thanks forreporting that, Phil. Ituncovered several bugs in 
> substitute-command-keys,some predating the curved-quote changes in Emacs 
> 25. I installed a patch into Emacs master as commit 
> 2791580f5eaa65948a13ea4ea4952d03b4da795b and am closing the bug as fixed.
> 
> For Emacs 25 I propose installing the attached patch, which should avoid 
> the emacs-goodies-el problem though it does not fix the other 
> (presumably less-likely) bugs in this area. This patch is considerably 
> simpler than what I just installed into master.

Thanks for fixing this.  However, I'm not sure I agree with the fix:
it looks like it loses support for unibyte strings in
substitute-command-keys?  If so, I don't think we should go that way:
Emacs in general tries to support both unibyte and multibyte strings
alike in all the primitives that handle strings (with the obvious
exception of encoding and decoding them), so losing that here would be
a regression.

Isn't it true that the problem was in this fragment:

      else if ((strp[0] == '`' || strp[0] == '\'')
	       && quoting_style == CURVE_QUOTING_STYLE)
	{
	  start = (unsigned char const *) (strp[0] == '`' ? uLSQM : uRSQM);
	  length = 1;
	  length_byte = sizeof uLSQM - 1;
	  idx = strp - SDATA (string) + 1;
	  goto subst_quote;
	}

The "length = 1" part is only correct if the argument string is
multibyte, and should otherwise count the number of bytes in
uLSQM/uRSQ, right?  If this is not the reason for the crash, could you
please describe the reason(s) in more detail, so that we could try to
find a solution that doesn't lose unibyte string support?





  reply	other threads:[~2016-08-14 14:27 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 18:55 bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault Phil
2016-08-11 20:05 ` Eli Zaretskii
2016-08-11 23:51   ` Philipp Stephani
2016-08-13  8:32     ` Eli Zaretskii
2016-08-13 12:25       ` Nicolas Petton
2016-08-14  6:33         ` John Wiegley
2016-08-14  4:54 ` Paul Eggert
2016-08-14 14:27   ` Eli Zaretskii [this message]
2016-08-14 14:51     ` Paul Eggert
2016-08-14 17:18       ` Eli Zaretskii
2016-08-15  2:04         ` Paul Eggert
2016-08-15 16:09           ` Eli Zaretskii
2016-08-15 16:46             ` Andreas Schwab
2016-08-15 18:43               ` Paul Eggert
2016-08-15 19:04                 ` Eli Zaretskii
2016-08-15 18:51               ` Eli Zaretskii
2016-08-15 19:05                 ` John Wiegley
2016-08-15 20:41                 ` Paul Eggert
2016-08-16 14:38                   ` Eli Zaretskii
2016-08-16 15:25                     ` John Wiegley
2016-08-16 16:09                       ` Nicolas Petton
2016-08-18 16:30                       ` Nicolas Petton
2016-08-18 16:41                         ` John Wiegley
2016-08-18 17:35                           ` Eli Zaretskii
2016-08-16 17:37                     ` Paul Eggert
2016-08-16 17:45                       ` John Wiegley
2016-08-16 17:55                         ` Paul Eggert
2016-08-16 17:57                           ` John Wiegley
2016-08-16 18:44                           ` Dmitry Gutov
2016-08-16 18:31                       ` Eli Zaretskii
2016-08-16 14:52                   ` Eli Zaretskii
2016-08-16 21:07                     ` Paul Eggert
2016-08-17 15:12                       ` Eli Zaretskii
2016-08-17 17:41                         ` Paul Eggert
2016-08-17 18:06                           ` Eli Zaretskii
2016-08-17 20:52                             ` Paul Eggert
2016-08-18 14:30                               ` Eli Zaretskii
2016-08-18 18:33                                 ` Paul Eggert
2016-08-18 18:58                                   ` Eli Zaretskii
2016-08-17 17:50                       ` Dmitry Gutov
2016-08-14 15:21   ` Dmitry Gutov
2016-08-15  1:53     ` Paul Eggert
2016-08-15  1:57       ` Dmitry Gutov
2016-08-15  2:05         ` Paul Eggert
2016-08-14 17:21   ` Eli Zaretskii
2016-08-14 20:16     ` Paul Eggert
2016-08-15  1:12       ` Paul Eggert

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=8337m7h1dp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=24206@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=johnw@gnu.org \
    --cc=nicolas@petton.fr \
    --cc=p.stephani2@gmail.com \
    /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.