From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault Date: Sun, 14 Aug 2016 17:27:14 +0300 Message-ID: <8337m7h1dp.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1471184966 23761 195.159.176.226 (14 Aug 2016 14:29:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Aug 2016 14:29:26 +0000 (UTC) Cc: p.stephani2@gmail.com, johnw@gnu.org, nicolas@petton.fr, 24206@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 14 16:29:22 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYwPf-0005sk-TU for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 16:29:20 +0200 Original-Received: from localhost ([::1]:32803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwPd-0001XK-1E for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 10:29:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwPU-0001Wm-4Z for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:29:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYwPO-0004NG-Tb for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:29:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwPO-0004NC-Pn for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bYwPO-0000Cz-57 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2016 14:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24206-submit@debbugs.gnu.org id=B24206.1471184887732 (code B ref 24206); Sun, 14 Aug 2016 14:29:02 +0000 Original-Received: (at 24206) by debbugs.gnu.org; 14 Aug 2016 14:28:07 +0000 Original-Received: from localhost ([127.0.0.1]:57389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYwOV-0000Bk-0P for submit@debbugs.gnu.org; Sun, 14 Aug 2016 10:28:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYwOT-0000B7-7v for 24206@debbugs.gnu.org; Sun, 14 Aug 2016 10:28:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYwOJ-00045b-Og for 24206@debbugs.gnu.org; Sun, 14 Aug 2016 10:27:59 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwO1-00044I-VE; Sun, 14 Aug 2016 10:27:37 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1157 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bYwNx-0004Sc-O3; Sun, 14 Aug 2016 10:27:36 -0400 In-reply-to: (message from Paul Eggert on Sat, 13 Aug 2016 23:54:43 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122199 Archived-At: > Cc: 24206-done@debbugs.gnu.org, Eli Zaretskii , > John Wiegley , Nicolas Petton > From: Paul Eggert > 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?