From c6f48259e237874f7a49d15a87e9bd55ba979971 Mon Sep 17 00:00:00 2001 From: Vincent Pit Date: Thu, 25 Jun 2009 20:49:49 +0200 Subject: 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) --- regcomp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'regcomp.c') 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) -- cgit v1.2.1