From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18610: 24.4.50; Specific file causing emacs to segfault upon opening Date: Fri, 03 Oct 2014 15:39:05 +0300 Message-ID: <837g0hiaza.fsf@gnu.org> References: <87eguqbk5m.fsf@gmail.com> <87iok2iio2.fsf@geodiff-mac3.ulb.ac.be> <83egupin8y.fsf@gnu.org> <542E86E4.2030205@yandex.ru> <83a95dibtt.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1412340028 3665 80.91.229.3 (3 Oct 2014 12:40:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Oct 2014 12:40:28 +0000 (UTC) Cc: dmantipov@yandex.ru, maden.ldm@gmail.com, 18610@debbugs.gnu.org To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 03 14:40:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xa29h-0006Zo-R9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Oct 2014 14:40:17 +0200 Original-Received: from localhost ([::1]:39246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa29h-0002X1-65 for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Oct 2014 08:40:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa29Z-0002Wo-KU for bug-gnu-emacs@gnu.org; Fri, 03 Oct 2014 08:40:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xa29T-00035P-NX for bug-gnu-emacs@gnu.org; Fri, 03 Oct 2014 08:40:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xa29T-000350-KZ for bug-gnu-emacs@gnu.org; Fri, 03 Oct 2014 08:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xa29S-0007hQ-MZ for bug-gnu-emacs@gnu.org; Fri, 03 Oct 2014 08:40: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: Fri, 03 Oct 2014 12:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18610 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18610-submit@debbugs.gnu.org id=B18610.141233995229391 (code B ref 18610); Fri, 03 Oct 2014 12:40:02 +0000 Original-Received: (at 18610) by debbugs.gnu.org; 3 Oct 2014 12:39:12 +0000 Original-Received: from localhost ([127.0.0.1]:59883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xa28d-0007dw-JD for submit@debbugs.gnu.org; Fri, 03 Oct 2014 08:39:12 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:54585) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xa28Y-0007dW-53 for 18610@debbugs.gnu.org; Fri, 03 Oct 2014 08:39:07 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NCV00000BK5FD00@mtaout24.012.net.il> for 18610@debbugs.gnu.org; Fri, 03 Oct 2014 15:33:09 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NCV00JHWC78U470@mtaout24.012.net.il>; Fri, 03 Oct 2014 15:33:09 +0300 (IDT) In-reply-to: <83a95dibtt.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:94091 Archived-At: > Date: Fri, 03 Oct 2014 15:20:46 +0300 > From: Eli Zaretskii > Cc: 18610@debbugs.gnu.org, maden.ldm@gmail.com > > --- src/coding.c 2014-08-06 17:37:22 +0000 > +++ src/coding.c 2014-10-03 12:09:28 +0000 > @@ -6559,7 +6559,8 @@ detect_coding (struct coding_system *cod > && ! inhibit_ied > && ! detect_info.checked) > { > - if (detect_coding_iso_2022 (coding, &detect_info)) > + if (detect_coding_iso_2022 (coding, &detect_info) > + && detect_info.found != 0) > { > /* We have scanned the whole data. */ > if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE)) > > Alternatively, perhaps detect_coding_iso_2022 shouldn't return 1 if the 'found' member is zero. Btw, there's one more issue that bothers me. In ONE_MORE_BYTE we have this: c = *src++; \ if (multibytep && (c & 0x80)) \ { \ if ((c & 0xFE) == 0xC0) \ c = ((c & 1) << 6) | *src++; \ else \ { \ src--; \ c = - string_char (src, &src, NULL); \ record_conversion_result \ (coding, CODING_RESULT_INVALID_SRC); \ } \ } \ If 'src' is a signed type, the first line above assigns a negative value to c for values beyond 127. But, as seen from the code after that, negative values have special meaning. So I wonder if we need to make sure the first line above always assigns non-negative values to c. Same problem exists in TWO_MORE_BYTES.