From c152dc430a400da208b684f936f242f4a89972f4 Mon Sep 17 00:00:00 2001 From: Hugo van der Sanden Date: Mon, 21 Oct 2002 04:21:54 +0100 Subject: [PATCH] Re: [perl #18019] regex overoptimization Message-Id: <200210210221.g9L2LsU32598@crypt.compulink.co.uk> p4raw-id: //depot/perl@18041 --- regcomp.c | 4 ++-- t/op/re_tests | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index cc283a6..8afb8ab 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1306,8 +1306,8 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg } else { /* start offset must point into the last copy */ data->last_start_min += minnext * (mincount - 1); - data->last_start_max += is_inf ? 0 : (maxcount - 1) - * (minnext + data->pos_delta); + data->last_start_max += is_inf ? I32_MAX + : (maxcount - 1) * (minnext + data->pos_delta); } } /* It is counted once already... */ diff --git a/t/op/re_tests b/t/op/re_tests index dcd6fdc..d7e24f3 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -923,3 +923,4 @@ ab(?i)cd abCd y - - 2(]*)?$\1 2 y $& 2 (??{}) x y - - a(b)?? abc y <$1> <> # undef [perl #16773] +(\d{1,3}\.){3,} 128.134.142.8 y <$1> <142.> # [perl #18019] -- 2.7.4