develooper Front page | perl.perl5.porters | Postings from August 2010

Re: [perl #57244] crash with recursive regexp

Thread Previous | Thread Next
From:
demerphq
Date:
August 23, 2010 08:51
Subject:
Re: [perl #57244] crash with recursive regexp
Message ID:
AANLkTikuEY287crSqLeyH10kJKr1TTRd0ZqE_C90iP95@mail.gmail.com
On 24 July 2008 14:32, Zefram <perlbug-followup@perl.org> wrote:
> # New Ticket Created by  Zefram
> # Please include the string:  [perl #57244]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57244 >
>
>
> This is a bug report for perl from zefram@fysh.org,
> generated with the help of perlbug 1.35 running under perl v5.8.8.
>
>
> -----------------------------------------------------------------
> [Please enter your report here]
>
> I have some horribly complicated regexps using the (??{}) facility
> to parse a recursive-descent grammar.  (Actually the real application
> is parsing a subset of Perl expression syntax.)  I'm getting crashes,
> mostly in the form of libc's malloc detecting corruption and aborting.
> Using valgrind I've narrowed things down, and here's my minimal test case:
>
> $ cat x1.pl
> use re "eval";
> my $dqstring_rx = qr/"(?:[^"\\]+|\\(?:e|x\{([0-9a-fA-F]+)\}))*"/;
> my $sqstring_rx = qr/'(?:aaa|bbb)'/;
> my $string_rx = qr/$dqstring_rx|$sqstring_rx/o;
> my $array_rx = qr/\[(??{$datum_rx}),*\]/o;
> my $datum_rx = qr/$string_rx|$array_rx/o;
> "['aaa','bbb',]" =~ /\A$array_rx\z/;
> $ valgrind perl x1.pl

This is fixed in 5.10/blead, I think by some patches I did to
(??{...}) compilation and buffer allocation. Not sure the number tho.

I think this ticket can be closed as fixed in 5.10

Cheers,
yves
-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


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