develooper Front page | perl.perl5.porters | Postings from March 2006

[perl #38379] Segmentation fault for matching too long regexps

From:
Steve Peters via RT
Date:
March 29, 2006 09:12
Subject:
[perl #38379] Segmentation fault for matching too long regexps
Message ID:
rt-3.0.11-38379-131647.0.00461510011952271@perl.org
> [ldebowsk@ipipan.waw.pl - Tue Jan 31 08:35:14 2006]:
> 
> 
> Thank you. Actually, I can live replacing +)+)+ by +){1,10}){1,100}, :).
> I am only concerned about the scarcity of information given by Perl when 
> its regex parser fails.
> 
> Isn't it possible just to handle the segfault signal coming from the
regex 
> engine and make it produce a more informative message? E.g. the message 
> that it was the regex engine failure in such and such line of the script. 
> If it is not possible, there should be some note in Perl documentation 
> that +)+)+ or some other complex matches may cause a segmentation fault 
> with little information about the cause.
> 
> Best,
> 
> Lukasz Debowski
> 
> *** www.ipipan.waw.pl/~ldebowsk ***
> 
> On Tue, 31 Jan 2006, yves orton via RT wrote:
> 
> > Id say that probably you could avoid the segfault by reworking your
> > pattern. Any time you see something like
> >
> > +)+)+
> >
> > in a pattern you should think carefully about whether the pattern can
> > be reworked to backtrack less often.
> >
> > And to fix this problem the perl regex engine needs to be converted
> > from recursive to interpretive. Which is code "its not getting fixed
> > anytime soon :-)"
> >
> > cheers,
> > Yves

Anytime soon is actually change #27598 :).  Now, after that change, the
first script loops without core dumping (I got to 256 iterations with a
core dump in 5.8.7, and to 5389 before hitting Ctrl-C in bleadperl).



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