From 7ef91622a9e34f97a4166311297799ae9bd8c402 Mon Sep 17 00:00:00 2001 From: Inaba Hiroto Date: Sat, 22 Mar 2003 02:35:21 +0900 Subject: [PATCH] Re: Parse::RecDescent triggers infinete loop in perl5.9.0 and 5.8.1 [perl #17757] Date: Fri, 21 Mar 2003 17:35:21 +0900 Message-ID: <3E7ACEC8.E0D57221@st.rim.or.jp> Date: Sat, 22 Mar 2003 11:28:05 +0900 Message-ID: <3E7BCA34.6824269F@st.rim.or.jp> p4raw-id: //depot/perl@19210 --- regexec.c | 6 +++--- t/op/pat.t | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/regexec.c b/regexec.c index 4692dcd..c8a46f0 100644 --- a/regexec.c +++ b/regexec.c @@ -544,7 +544,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, goto fail_finish; /* we may be pointing at the wrong string */ if (s && RX_MATCH_COPIED(prog)) - s = prog->subbeg + (s - SvPVX(sv)); + s = strbeg + (s - SvPVX(sv)); if (data) *data->scream_olds = s; } @@ -1862,7 +1862,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * PL_multiline ? FBMrf_MULTILINE : 0))) ) { /* we may be pointing at the wrong string */ if ((flags & REXEC_SCREAM) && RX_MATCH_COPIED(prog)) - s = prog->subbeg + (s - SvPVX(sv)); + s = strbeg + (s - SvPVX(sv)); DEBUG_r( did_match = 1 ); if (HOPc(s, -back_max) > last1) { last1 = HOPc(s, -back_min); @@ -1951,7 +1951,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * last = scream_olds; /* Only one occurrence. */ /* we may be pointing at the wrong string */ else if (RX_MATCH_COPIED(prog)) - s = prog->subbeg + (s - SvPVX(sv)); + s = strbeg + (s - SvPVX(sv)); } else { STRLEN len; diff --git a/t/op/pat.t b/t/op/pat.t index 16a3820..26e8594 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..996\n"; +print "1..997\n"; BEGIN { chdir 't' if -d 't'; @@ -3159,4 +3159,11 @@ ok("bbbbac" =~ /$pattern/ && $1 eq 'a', "[perl #3547]"); ok(join(":", /\b(.)\x{100}/g) eq "a:/", "re_intuit_start and PL_bostr"); } -# last test 996 +{ + $_ = "code: 'x' { '...' }\n"; study; + my @x; push @x, $& while m/'[^\']*'/gx; + ok(join(":", @x) eq "'x':'...'", + "[perl #17757] Parse::RecDescent triggers infinite loop"); +} + +# last test 997 -- 2.7.4