From 3a2830bee4dd1d02a42b80355c401107dd195eeb Mon Sep 17 00:00:00 2001 From: Animator Date: Wed, 12 Apr 2006 08:27:41 -0700 Subject: [PATCH] [perl #38906] Regex engine does not release MINMOD From: "Animator via RT" Message-ID: zero-length minimum matches that failed could leak into a following maximal match p4raw-id: //depot/perl@27782 --- regexec.c | 3 +++ t/op/re_tests | 2 ++ 2 files changed, 5 insertions(+) diff --git a/regexec.c b/regexec.c index 71eab5b..47c4422 100644 --- a/regexec.c +++ b/regexec.c @@ -2211,6 +2211,7 @@ typedef struct { regnode *next; char *locinput; I32 nextchr; + int minmod; #ifdef DEBUGGING int regindent; #endif @@ -3795,6 +3796,7 @@ S_regmatch(pTHX_ regexp *rex, regnode *prog) uw->next = next; uw->locinput = locinput; uw->nextchr = nextchr; + uw->minmod = st->minmod; #ifdef DEBUGGING uw->regindent = ++PL_regindent; #endif @@ -4503,6 +4505,7 @@ do_no: PL_regendp[n] = -1; *PL_reglastparen = n; scan = next = uwb->next; + st->minmod = uwb->minmod; if ( !scan || OP(scan) != (uwb->type == RE_UNWIND_BRANCH ? BRANCH : BRANCHJ) ) { /* Failure */ diff --git a/t/op/re_tests b/t/op/re_tests index 8520d99..4b9ae61 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -959,3 +959,5 @@ x(?# x c - Sequence (?#... not terminated ^(a*?)(?!(aa|aaaa)*$) aaaaaaaaaaaaaaaaaaaa y $1 a # [perl #34195] ^(a*?)(?!(aa|aaaa)*$)(?=a\z) aaaaaaaa y $1 aaaaaaa ^(.)\s+.$(?(1)) A B y $1 A # [perl #37688] +(?:r?)*?r|(.{2,4}) abcde y $1 abcd +(?!)+?|(.{2,4}) abcde y $1 abcd -- 2.7.4