From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Stack overflow in regexp matcher Date: Sun, 06 Feb 2011 17:02:20 +0100 Message-ID: <87r5blrw1f.fsf@escher.home> References: <87wrldcmrk.fsf@escher.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297008185 27490 80.91.229.12 (6 Feb 2011 16:03:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Feb 2011 16:03:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 06 17:03:01 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pm74m-0002nT-Fp for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Feb 2011 17:03:00 +0100 Original-Received: from localhost ([127.0.0.1]:34521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pm74k-00066H-Rq for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Feb 2011 11:02:58 -0500 Original-Received: from [140.186.70.92] (port=45361 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pm74O-00065y-NY for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 11:02:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pm74N-0007uT-1W for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 11:02:36 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:49855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pm74M-0007uD-M4 for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 11:02:34 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Pm74K-0002Y3-1U for help-gnu-emacs@gnu.org; Sun, 06 Feb 2011 17:02:32 +0100 Original-Received: from i59f56f18.versanet.de ([89.245.111.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Feb 2011 17:02:32 +0100 Original-Received: from stephen.berman by i59f56f18.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Feb 2011 17:02:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: i59f56f18.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78989 Archived-At: On Sun, 06 Feb 2011 09:17:50 -0500 Eli Zaretskii wrote: >> From: Stephen Berman >> Date: Sun, 06 Feb 2011 14:31:43 +0100 >> >> On Sun, 06 Feb 2011 10:47:42 +0000 Dan Davison wrote: >> >> > The following fails with "Stack overflow in regexp matcher" in emacs 23 >> > and 24: >> > >> > (string-match >> > "^\\[.+\\]$" >> > (concat >> > "[" >> > (mapconcat (lambda (i) "x") (number-sequence 1 33500) "") >> > "]")) >> > >> > This surprised me; I assumed that the ^ and $ anchors, and the simple >> > ".+" requirement in the middle would result in a simple, efficient >> > regexp. >> >> It does not fail on my GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ >> Version 2.20.1) of 2011-01-13, but returns, as expected, 0. > > Nor does it fail here: > > GNU Emacs 23.2.91.1 (i386-mingw-nt5.1.2600) of 2010-12-11 on 3249CTO > > but does enter the debugger here: > > GNU Emacs 23.2.93.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of > 2011-02-03 on fencepost > > I guess it depends on how large is the available stack space. That indeed seems to be the case: on my system, it succeeds with (number-sequence 1 66665) but fails with (number-sequence 1 66666). Steve Berman