From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#8601: * 2 -> * 4 typo fix in detect_coding_charset Date: Sun, 01 May 2011 11:19:09 -0700 Organization: UCLA Computer Science Department Message-ID: <4DBDA41D.1010008@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1304275022 30337 80.91.229.12 (1 May 2011 18:37:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 May 2011 18:37:02 +0000 (UTC) Cc: Miles Bader To: 8601@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 01 20:36:58 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QGbVq-0008RW-3E for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 May 2011 20:36:58 +0200 Original-Received: from localhost ([::1]:58609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbVp-0007E9-GG for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 May 2011 14:36:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbVm-0007Ds-J4 for bug-gnu-emacs@gnu.org; Sun, 01 May 2011 14:36:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGbVl-0002fF-L3 for bug-gnu-emacs@gnu.org; Sun, 01 May 2011 14:36:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbVl-0002fA-JS for bug-gnu-emacs@gnu.org; Sun, 01 May 2011 14:36:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QGbFT-0008HB-C6; Sun, 01 May 2011 14:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 May 2011 18:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8601 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130427396231755 (code B ref -1); Sun, 01 May 2011 18:20:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 May 2011 18:19:22 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QGbEo-0008G8-Hi for submit@debbugs.gnu.org; Sun, 01 May 2011 14:19:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QGbEm-0008Fx-Ga for submit@debbugs.gnu.org; Sun, 01 May 2011 14:19:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGbEg-0008H3-ES for submit@debbugs.gnu.org; Sun, 01 May 2011 14:19:15 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:34063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbEg-0008Gw-CS for submit@debbugs.gnu.org; Sun, 01 May 2011 14:19:14 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbEf-0005Hb-7B for bug-gnu-emacs@gnu.org; Sun, 01 May 2011 14:19:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGbEe-0008GW-3T for bug-gnu-emacs@gnu.org; Sun, 01 May 2011 14:19:13 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:53878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGbEd-0008GR-UN; Sun, 01 May 2011 14:19:12 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id EA3FD39E8083; Sun, 1 May 2011 11:19:10 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EbqSoKJoCReB; Sun, 1 May 2011 11:19:10 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 205D339E80F5; Sun, 1 May 2011 11:19:10 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 01 May 2011 14:20:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46132 Archived-At: By code inspection it appears that there's a typo in detect_coding_charset: an index is multiplied by 2 when it should be multiplied by 4. By bisecting it appears that this typo was introduced here: revno: 84043 [merge] committer: Miles Bader timestamp: Fri 2008-02-01 16:01:31 +0000 message: Merge unicode branch Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1037 so I'll CC: this to Miles. Here's a proposed patch. I haven't tested this, as I don't have the time to fully understand this code. But from the description and other uses of code_space, the "* 2" must be wrong. === modified file 'src/coding.c' --- src/coding.c 2011-04-29 19:47:29 +0000 +++ src/coding.c 2011-05-01 18:05:21 +0000 @@ -5368,8 +5368,8 @@ detect_coding_charset (struct coding_sys if (src == src_end) goto too_short; ONE_MORE_BYTE (c); - if (c < charset->code_space[(dim - 1 - idx) * 2] - || c > charset->code_space[(dim - 1 - idx) * 2 + 1]) + if (c < charset->code_space[(dim - 1 - idx) * 4] + || c > charset->code_space[(dim - 1 - idx) * 4 + 1]) break; } if (idx < dim)