In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/ee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f?hp=d00c6acb5649055ca8b949a4bc7e614ee7cf8323>

- Log -----------------------------------------------------------------
commit ee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f
Author: Vincent Pit <[email protected]>
Date:   Thu Jun 25 20:49:49 2009 +0200

    Update RExC_npar and after_freeze correctly after the first branch of a (?| 
... )
    
    This fixes RT #59734 : Segfault when using (?|) in regexp.
-----------------------------------------------------------------------

Summary of changes:
 regcomp.c     |    7 +++++++
 t/op/re_tests |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/regcomp.c b/regcomp.c
index bc7086f..7e80041 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6138,6 +6138,13 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 
*flagp,U32 depth)
     /* Pick up the branches, linking them together. */
     parse_start = RExC_parse;   /* MJD */
     br = regbranch(pRExC_state, &flags, 1,depth+1);
+
+    if (freeze_paren) {
+        if (RExC_npar > after_freeze)
+            after_freeze = RExC_npar;
+        RExC_npar = freeze_paren;
+    }
+
     /*     branch_len = (paren != 0); */
 
     if (br == NULL)
diff --git a/t/op/re_tests b/t/op/re_tests
index 0c04840..89934fd 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -1311,6 +1311,11 @@ X(\w+)(?=\s)|X(\w+)      Xab     y       [$1-$2] [-ab]
 (?|(?|(a)|(b))|(?|(c)|(d)))    d       y       $1      d
 (.)(?|(.)(.)x|(.)d)(.) abcde   y       $1-$2-$3-$4-$5- b-c--e--
 (\N)(?|(\N)(\N)x|(\N)d)(\N)    abcde   y       $1-$2-$3-$4-$5- b-c--e--
+(?|(?<foo>x))  x       y       $+{foo} x
+(?|(?<foo>x)|(?<bar>y))        x       y       $+{foo} x
+(?|(?<bar>y)|(?<foo>x))        x       y       $+{foo} x
+(?<bar>)(?|(?<foo>x))  x       y       $+{foo} x
+
 #Bug #41492
 (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    a       y       $&      a
 (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    aa      y       $&      aa

--
Perl5 Master Repository

Reply via email to