summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorVincent Pit <vince@profvince.com>2009-06-25 20:49:49 +0200
committerDavid Mitchell <davem@iabyn.com>2009-06-27 16:05:03 +0100
commitc6f48259e237874f7a49d15a87e9bd55ba979971 (patch)
treeff9c0cf01425ff5b163ea67a229b0bd1906d0550 /regcomp.c
parent867dc45802c58d6e22e6953bf1039176a7481d53 (diff)
downloadperl-c6f48259e237874f7a49d15a87e9bd55ba979971.tar.gz
Update RExC_npar and after_freeze correctly after the first branch of a (?| ... )
This fixes RT #59734 : Segfault when using (?|) in regexp. (cherry-picked from commit ee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f)
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 299f925b01..ccbe98257d 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6119,6 +6119,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)