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

Wrong RE match in 5.10.0

Thread Next
From:
Gisle Aas
Date:
August 23, 2008 00:56
Subject:
Wrong RE match in 5.10.0
Message ID:
5E723618-94E8-4265-A662-A4D8D6D34BEA@activestate.com
In the Data::Dump module I had the following (stupid) regular  
expression that ends up dumping core in 5.8 when the RE engine blows  
the stack.  I'm fine with that, but what caught my eye was that  
5.10.0 which avoids the segfault simply return the wrong match.  I  
think it would have been better for it to raise an exception if it  
refuse to loop longer than to return the wrong result.

--Gisle


#!perl

for (1, 10, 100) {
     $str = "x" x ($_ * 1024);
     if ($str =~ /^(.{1,5}?)(\1*)\z/s) {
         print "$1 ", length($2), "\n";
     }
     else {
         print "no match\n";
     }
}

__END__


With 5.8 this prints:

x 1023
x 10239
Segmentation fault

With 5.10 this prints:

x 1023
x 10239
xxxx 102396


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