From: Hugo van der Sanden Date: Tue, 13 Feb 2001 00:11:11 +0000 (+0000) Subject: Re: [ID 20010212.006] Core dump with /((?:hard|soft)cover)?/ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f49d4d0f1aad3e3c7e34453d2bac9954bf237486;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20010212.006] Core dump with /((?:hard|soft)cover)?/ Message-Id: <200102130011.AAA14310@crypt.compulink.co.uk> p4raw-id: //depot/perl@8779 --- diff --git a/regcomp.c b/regcomp.c index bdcea75..547f756 100644 --- a/regcomp.c +++ b/regcomp.c @@ -650,21 +650,19 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg #endif n = regnext(n); } - else { + else if (stringok) { int oldl = STR_LEN(scan); regnode *nnext = regnext(n); - + if (oldl + STR_LEN(n) > U8_MAX) break; NEXT_OFF(scan) += NEXT_OFF(n); STR_LEN(scan) += STR_LEN(n); next = n + NODE_SZ_STR(n); /* Now we can overwrite *n : */ - Move(STRING(n), STRING(scan) + oldl, - STR_LEN(n), char); + Move(STRING(n), STRING(scan) + oldl, STR_LEN(n), char); #ifdef DEBUGGING - if (stringok) - stop = next - 1; + stop = next - 1; #endif n = nnext; } diff --git a/t/op/re_tests b/t/op/re_tests index 1090e11..6477d67 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -782,3 +782,5 @@ tt+$ xxxtt y - - ^(b+?|a){1,2}c bbbac y $1 a ^(b+?|a){1,2}c bbbbac y $1 a \((\w\. \w+)\) cd. (A. Tw) y -$1- -A. Tw- +((?:aaaa|bbbb)cccc)? aaaacccc y - - +((?:aaaa|bbbb)cccc)? bbbbcccc y - -