From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#1864: 23.0.60; detect attached file coding system, make emacs crash. Date: Tue, 13 Jan 2009 22:54:29 -0500 Message-ID: <87priq8ruy.fsf@cyd.mit.edu> Reply-To: Chong Yidong , 1864@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1231905883 15751 80.91.229.12 (14 Jan 2009 04:04:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Jan 2009 04:04:43 +0000 (UTC) Cc: 1864@emacsbugs.donarmstrong.com, Wang Diancheng To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 14 05:05:55 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LMx0I-0005WO-8L for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Jan 2009 05:05:45 +0100 Original-Received: from localhost ([127.0.0.1]:42957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMwz0-00030b-VG for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Jan 2009 23:03:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMwyv-0002yK-P4 for bug-gnu-emacs@gnu.org; Tue, 13 Jan 2009 23:03:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMwyu-0002wR-5A for bug-gnu-emacs@gnu.org; Tue, 13 Jan 2009 23:03:53 -0500 Original-Received: from [199.232.76.173] (port=58535 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMwyu-0002wF-1H for bug-gnu-emacs@gnu.org; Tue, 13 Jan 2009 23:03:52 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43635) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMwyt-0004uQ-CD for bug-gnu-emacs@gnu.org; Tue, 13 Jan 2009 23:03:51 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0E43PkZ029149; Tue, 13 Jan 2009 20:03:26 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n0E403NT028070; Tue, 13 Jan 2009 20:00:03 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 14 Jan 2009 04:00:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 1864 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1864-submit@emacsbugs.donarmstrong.com id=B1864.123190525526726 (code B ref 1864); Wed, 14 Jan 2009 04:00:03 +0000 Original-Received: (at 1864) by emacsbugs.donarmstrong.com; 14 Jan 2009 03:54:15 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0E3sDVi026719 for <1864@emacsbugs.donarmstrong.com>; Tue, 13 Jan 2009 19:54:14 -0800 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 06E1157E211; Tue, 13 Jan 2009 22:54:29 -0500 (EST) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 13 Jan 2009 23:03:53 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:24096 > detect attached file coding system with following code, make emacs crash > > (with-temp-buffer > (insert-file-contents "/home/dcwang/1.txt") > (detect-coding-region (point-min) (point-max) t)) Looks like detect_coding_utf_16 forgets to check for negative values of ONE_MORE_BYTE. Handa-san, could you check the following patch? *** trunk/src/coding.c.~1.406.~ 2009-01-11 08:23:34.000000000 -0500 --- trunk/src/coding.c 2009-01-13 22:54:10.000000000 -0500 *************** *** 1612,1617 **** --- 1612,1621 ---- { ONE_MORE_BYTE (c1); ONE_MORE_BYTE (c2); + + if (c1 < 0 || c2 < 0) + break; + if (! e[c1]) { e[c1] = 1;