diff options
author | Yves Orton <demerphq@gmail.com> | 2012-04-22 15:58:32 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2012-05-27 14:51:31 +0200 |
commit | dee29c6b5bec1d6e7fccc971e31113a5d7cee844 (patch) | |
tree | 8672b73abbc81afe18e3c7f37dfbd40fdf219212 /regexec.c | |
parent | f0ccce9ba3f3b541e45776f57b8f362699c084d9 (diff) | |
download | perl-dee29c6b5bec1d6e7fccc971e31113a5d7cee844.tar.gz |
fix [perl #76546] regex engine slowdown bug
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -561,6 +561,7 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, I32 ml_anch; register char *other_last = NULL; /* other substr checked before this */ char *check_at = NULL; /* check substr found at this pos */ + char *checked_upto = NULL; /* how far into the string we have already checked using find_byclass*/ const I32 multiline = prog->extflags & RXf_PMf_MULTILINE; RXi_GET_DECL(prog,progi); #ifdef DEBUGGING @@ -1090,15 +1091,20 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, else endpos= strend; - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "start_shift: %"IVdf" check_at: %"IVdf" s: %"IVdf" endpos: %"IVdf"\n", - (IV)start_shift, (IV)(check_at - strbeg), (IV)(s - strbeg), (IV)(endpos - strbeg))); - + if (!checked_upto) + checked_upto = s; + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "start_shift: %"IVdf" check_at: %"IVdf" s: %"IVdf" endpos: %"IVdf" checked_upto: %"IVdf"\n", + (IV)start_shift, (IV)(check_at - strbeg), (IV)(s - strbeg), (IV)(endpos - strbeg), (IV)(checked_upto- strbeg))); + t = s; - s = find_byclass(prog, progi->regstclass, s, endpos, NULL); - if (!s) { + s = find_byclass(prog, progi->regstclass, checked_upto, endpos, NULL); + if (s) { + checked_upto = s; + } else { #ifdef DEBUGGING const char *what = NULL; #endif + checked_upto = endpos; if (endpos == strend) { DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, "Could not match STCLASS...\n") ); |