summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorVincent Pit <vince@profvince.com>2009-06-25 20:49:49 +0200
committerYves Orton <demerphq@gmail.com>2009-06-26 19:55:34 +0200
commitee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f (patch)
tree0441a1261afaca6028f4a91c6a12516d200c3c88 /regcomp.c
parentd00c6acb5649055ca8b949a4bc7e614ee7cf8323 (diff)
downloadperl-ee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f.tar.gz
Update RExC_npar and after_freeze correctly after the first branch of a (?| ... )
This fixes RT #59734 : Segfault when using (?|) in regexp.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index bc7086f8df..7e80041d0b 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)