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#2844: infinite loop in boyer_moore() Date: Thu, 16 Apr 2009 00:51:45 -0400 Message-ID: <87prfdp5em.fsf__45286.0053665519$1239858370$gmane$org@cyd.mit.edu> References: <87eiwaheu9.fsf@cyd.mit.edu> Reply-To: Chong Yidong , 2844@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 1239858284 5693 80.91.229.12 (16 Apr 2009 05:04:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Apr 2009 05:04:44 +0000 (UTC) Cc: 2844@emacsbugs.donarmstrong.com To: emacs-devel@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 16 07: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 1LuJn9-0007Zk-Ms for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Apr 2009 07:05:53 +0200 Original-Received: from localhost ([127.0.0.1]:58675 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuJll-0003Wj-4f for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Apr 2009 01:04:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuJlg-0003WU-17 for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2009 01:04:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuJla-0003Tn-SU for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2009 01:04:06 -0400 Original-Received: from [199.232.76.173] (port=49654 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuJla-0003Tk-M2 for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2009 01:04:02 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43976) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LuJla-0005Tc-26 for bug-gnu-emacs@gnu.org; Thu, 16 Apr 2009 01:04:02 -0400 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 n3G53o8I032001; Wed, 15 Apr 2009 22:03:51 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n3G4t5YC029708; Wed, 15 Apr 2009 21:55:05 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 16 Apr 2009 04:55:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2844 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 2844-submit@emacsbugs.donarmstrong.com id=B2844.123985739928190 (code B ref 2844); Thu, 16 Apr 2009 04:55:05 +0000 Original-Received: (at 2844) by emacsbugs.donarmstrong.com; 16 Apr 2009 04:49:59 +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 n3G4numC028184 for <2844@emacsbugs.donarmstrong.com>; Wed, 15 Apr 2009 21:49:58 -0700 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 51DAD57E245; Thu, 16 Apr 2009 00:51:45 -0400 (EDT) In-Reply-To: <87eiwaheu9.fsf@cyd.mit.edu> (Chong Yidong's message of "Thu, 02 Apr 2009 18:26:38 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 16 Apr 2009 01:04:06 -0400 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:27224 Archived-At: Ping. Anyone have an opinion? >> Gnus has been entering infinite loops for me while splitting mail. >> Today I got a chance to look into it. The problem is in >> boyer_moore(), in search.c: > >> /* Use signed comparison if appropriate >> to make cursor+infinity sure to be > p_limit. >> Assuming that the buffer lies in a range of addresses >> that are all "positive" (as ints) or all "negative", >> either kind of comparison will work as long >> as we don't step by infinity. So pick the kind >> that works when we do step by infinity. */ >> if ((EMACS_INT) (p_limit + infinity) > (EMACS_INT) p_limit) >> while ((EMACS_INT) cursor <= (EMACS_INT) p_limit) >> cursor += BM_tab[*cursor]; >> else >> while ((EMACS_UINT) cursor <= (EMACS_UINT) p_limit) >> cursor += BM_tab[*cursor]; > >> it takes the signed (EMACS_INT) loop, but that fails because cursor is >> (unsigned char *) 0x7fffc440, whereas p_limit is (unsigned char *) >> 0x80001260. > >> infinity, computed earlier in that function, is 0x37dac21, but I don't >> see how a positive value would have helped. It seems to me that we >> have to check that we won't be crossing this boundary starting at >> cursor rather than p_limit, or maybe both. I haven't thought much >> about it. > > Checking with cursor as well as p_limit sounds about right to be, but I > am far from familiar with this part of the code. Does anyone one this > list have an opinion?