From unknown Tue Jun 24 17:22:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#1900 <1900@debbugs.gnu.org> To: bug#1900 <1900@debbugs.gnu.org> Subject: Status: 23.0.60; detect attached file coding system, make emacs crash. Reply-To: bug#1900 <1900@debbugs.gnu.org> Date: Wed, 25 Jun 2025 00:22:30 +0000 retitle 1900 23.0.60; detect attached file coding system, make emacs crash. reassign 1900 emacs submitter 1900 Kenichi Handa severity 1900 normal thanks From handa@m17n.org Wed Jan 14 04:54:02 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 14 Jan 2009 12:54:02 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: ** X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=2.0 required=4.0 tests=GMAIL,IMPRONONCABLE_2, MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0ECrwuA000889 for ; Wed, 14 Jan 2009 04:54:00 -0800 Received: from mail.gnu.org ([199.232.76.166]:47592 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LN5Eb-0000OE-OS for emacs-pretest-bug@gnu.org; Wed, 14 Jan 2009 07:52:37 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LN5Fq-00033h-Dt for emacs-pretest-bug@gnu.org; Wed, 14 Jan 2009 07:53:54 -0500 Received: from mx1.aist.go.jp ([150.29.246.133]:52716) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LN5Fp-000335-Mf; Wed, 14 Jan 2009 07:53:54 -0500 Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id n0ECriYt026634; Wed, 14 Jan 2009 21:53:44 +0900 (JST) env-from (handa@m17n.org) Received: from smtp4.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id n0ECrixn003580; Wed, 14 Jan 2009 21:53:44 +0900 (JST) env-from (handa@m17n.org) Received: by smtp4.aist.go.jp with ESMTP id n0ECri5E011922; Wed, 14 Jan 2009 21:53:44 +0900 (JST) env-from (handa@m17n.org) Received: from handa by etlken.m17n.org with local (Exim 4.69) (envelope-from ) id 1LN5Fg-0000hJ-8L; Wed, 14 Jan 2009 21:53:44 +0900 From: Kenichi Handa To: Wang Diancheng CC: emacs-pretest-bug@gnu.org, emacs-devel@gnu.org In-reply-to: <877i51fd95.fsf@redflag-linux.com> (message from Wang Diancheng on Mon, 12 Jan 2009 10:51:18 +0800) Subject: Re: 23.0.60; detect attached file coding system, make emacs crash. References: <877i51fd95.fsf@redflag-linux.com> Message-Id: Date: Wed, 14 Jan 2009 21:53:44 +0900 X-detected-operating-system: by monty-python.gnu.org: Solaris 9 In article <877i51fd95.fsf@redflag-linux.com>, Wang Diancheng writes: > 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)) Thank you for the bug report. I've just committed a fix. But, the above code doesn't work as you expect because insert-file-contents inserts already decoded text in a buffer. You should do something like this, and this is faster. (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) (insert-file-contents "/home/dcwang/1.txt") (detect-coding-region (point-min) (point-max) t))) Chong Yidong writes: > Looks like detect_coding_utf_16 forgets to check for negative values of > ONE_MORE_BYTE. Yes. But... > Handa-san, could you check the following patch? > ONE_MORE_BYTE (c1); > ONE_MORE_BYTE (c2); > + > + if (c1 < 0 || c2 < 0) > + break; > + > if (! e[c1]) > { > e[c1] = 1; That's not enough. c1 and c2 must be checked here too: e[c1] = 1; o[c2] = 1; "Juanma Barranquero" writes: > Don't you need a test also before lines 1605-1606, where c1 and c2 are > used as array indexes? That's not necessary because if c1 and c2 are non-negative, it is assured that they are byte values; i.e. less than 256. --- Kenichi Handa handa@m17n.org From cyd@stupidchicken.com Wed Jan 14 05:33:50 2009 Received: (at control) by emacsbugs.donarmstrong.com; 14 Jan 2009 13:33:50 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=none autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 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 n0EDXiIf011626 for ; Wed, 14 Jan 2009 05:33:45 -0800 Received: by cyd.mit.edu (Postfix, from userid 1000) id 2F68057E1D7; Wed, 14 Jan 2009 08:34:01 -0500 (EST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close bug Date: Wed, 14 Jan 2009 08:34:01 -0500 Message-ID: <878wpeui46.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii merge 1864,1900 close 1864 close 1900 thanks From unknown Tue Jun 24 17:22:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Wed, 11 Feb 2009 15:24:08 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator