Change 34580 by [EMAIL PROTECTED] on 2008/10/25 08:34:19
Subject: Re: [perl #60034] (?>) causes wrongness on long string
From: Vincent Pit <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Date: Thu, 23 Oct 2008 00:40:36 +0200
Affected files ...
... //depot/maint-5.8/perl/regexec.c#105 edit
... //depot/maint-5.8/perl/t/op/pat.t#55 edit
Differences ...
==== //depot/maint-5.8/perl/regexec.c#105 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#104~34396~ 2008-09-22 06:52:27.000000000 -0700
+++ perl/regexec.c 2008-10-25 01:34:19.000000000 -0700
@@ -3192,7 +3192,8 @@
PL_reginput = locinput;
maxwanted = minmod ? ln : n;
if (maxwanted) {
- while (PL_reginput < PL_regeol && matches < maxwanted) {
+ while (PL_reginput < PL_regeol && (maxwanted == REG_INFTY
+ || matches < maxwanted)) {
if (!regmatch(scan))
break;
/* on first match, determine length, l */
==== //depot/maint-5.8/perl/t/op/pat.t#55 (xtext) ====
Index: perl/t/op/pat.t
--- perl/t/op/pat.t#54~34396~ 2008-09-22 06:52:27.000000000 -0700
+++ perl/t/op/pat.t 2008-10-25 01:34:19.000000000 -0700
@@ -3845,6 +3845,17 @@
'IsPunct agrees with [:punct:] with explicit Latin1');
}
+# [perl #60034]
+{
+ my $a = "xyzt" x 8192;
+ ok($a =~ /\A(?>[a-z])*\z/, '(?>) does not cause wrongness on long string');
+ my $b = $a . chr 256;
+ chop $b;
+ iseq($a, $b);
+ ok($b =~ /\A(?>[a-z])*\z/,
+ '(?>) does not cause wrongness on long string with UTF-8');
+}
+
# Test counter is at bottom of file. Put new tests above here.
#-------------------------------------------------------------------
# Keep the following tests last -- they may crash perl
@@ -3860,4 +3871,4 @@
# Put new tests above the dotted line about a page above this comment
-BEGIN{print "1..1273\n"};
+BEGIN{print "1..1276\n"};
End of Patch.