help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack overflow in regexp matcher


From: Stephen Berman
Subject: Re: Stack overflow in regexp matcher
Date: Sun, 06 Feb 2011 17:02:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Sun, 06 Feb 2011 09:17:50 -0500 Eli Zaretskii <address@hidden> wrote:

>> From: Stephen Berman <address@hidden>
>> Date: Sun, 06 Feb 2011 14:31:43 +0100
>> 
>> On Sun, 06 Feb 2011 10:47:42 +0000 Dan Davison <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]