From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault Date: Sun, 14 Aug 2016 09:51:43 -0500 Message-ID: References: <8337m7h1dp.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1471186340 21386 195.159.176.226 (14 Aug 2016 14:52:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Aug 2016 14:52:20 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 Cc: p.stephani2@gmail.com, johnw@gnu.org, nicolas@petton.fr, 24206@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 14 16:52:16 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 1bYwlr-0005Lw-C6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 16:52:15 +0200 Original-Received: from localhost ([::1]:32843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwlo-0004GU-H7 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 10:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwli-0004GE-T2 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:52:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYwle-0007kL-OP for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:52:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYwle-0007kG-Ln for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bYwle-0000kQ-B2 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 10:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2016 14:52: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.14711863182864 (code B ref 24206); Sun, 14 Aug 2016 14:52:02 +0000 Original-Received: (at 24206) by debbugs.gnu.org; 14 Aug 2016 14:51:58 +0000 Original-Received: from localhost ([127.0.0.1]:57398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYwla-0000k8-FX for submit@debbugs.gnu.org; Sun, 14 Aug 2016 10:51:58 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51219) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYwlT-0000jq-Ut for 24206@debbugs.gnu.org; Sun, 14 Aug 2016 10:51:57 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0CD751611E4; Sun, 14 Aug 2016 07:51:46 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mEXkEePKRFDm; Sun, 14 Aug 2016 07:51:45 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 54870161220; Sun, 14 Aug 2016 07:51:45 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id hH_2M8aW8zrw; Sun, 14 Aug 2016 07:51:45 -0700 (PDT) Original-Received: from [192.168.4.53] (ip-64-134-49-17.public.wayport.net [64.134.49.17]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A3AB11611E4; Sun, 14 Aug 2016 07:51:44 -0700 (PDT) In-Reply-To: <8337m7h1dp.fsf@gnu.org> 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:122201 Archived-At: On 08/14/2016 09:27 AM, Eli Zaretskii wrote: > 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? This string is by definition multibyte at that point, since that part of the code is inserting a Unicode character that is not ASCII. More generally, Fsubstitute_command_keys is quite confused about unibyte versus multibyte issues. It merges together a number of strings, and assumes that they are all multibyte iff the original string is multibyte, which is obviously not true in general. (This problem is not limited to the requoting part of the code.) In master, I've altered the implementation to always generate either the original string, or an ASCII string, or a multibyte string. Since substitute-command-keys is not intended to be used on encoded unibyte text, that's good enough.