develooper Front page | perl.perl5.porters | Postings from January 2005

Re: [perl #33945] Segmentation fault with deep recursion in regex engine

Thread Previous
From:
Dave Mitchell
Date:
January 29, 2005 07:38
Subject:
Re: [perl #33945] Segmentation fault with deep recursion in regex engine
Message ID:
20050129153847.GE5366@iabyn.com
On Wed, Jan 26, 2005 at 10:07:17PM -0000, A. Pagaltzis wrote:
> Deep recursion the regex engine causes a segfault. While there's
> nothing that can really be done other than aborting the program
> in that case, that should at least be done in orderly fashion.
> 
> The condition can easily be reproduced thusly:
> 
> 	perl -le'my $rx; $rx=qr/(??{ $rx })/; ""=~$rx'

I can't really see what else Perl can do. The segfault happens when Perl
extends the stack too far. This can't be avoided. The SIGSEGV could be
caught, but then there's nothing sensible that perl could then do to
retrieve the situation.


-- 
My get-up-and-go just got up and went.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About