[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Wrong RE match in 5.10.0
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
- Follow-Ups from:
-
Bram <p5p@perl.wizbit.be>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]