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

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

From:
Lukasz Debowski
Date:
January 31, 2006 07:03
Subject:
Re: [perl #38379] Segmentation fault for matching too long regexps
Message ID:
Pine.GSO.4.61.0601311452050.19130@sawa

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
>
> --
> perl -Mre=debug -e "/just|another|perl|hacker/"
>
>



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