summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2015-02-17 03:27:33 +0000
committerHugo van der Sanden <hv@crypt.org>2015-02-18 01:40:44 +0000
commite92b41c6ac6bcd8786b0448c8337c4151e4f9a63 (patch)
tree6c7b0e81f99418fd7d027fed6e3379a897abc169 /regcomp.c
parent04ffdf6a81289d4734cb56d4feeba6e14d1c7f8e (diff)
downloadperl-e92b41c6ac6bcd8786b0448c8337c4151e4f9a63.tar.gz
[perl #123852] avoid capture side-effects under noncapture flag
//n was implemented by avoiding the primary side-effects of compiling a capture when the flag was turned on; however some secondary effects still occurred later in the same function, by using the value of the 'paren' variable - even as far as causing coredumps. Setting paren to ':' when NOCAPTURE is enabled makes the rest of the function act just as if it had parsed (?:...) instead of (...).
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/regcomp.c b/regcomp.c
index 51c778d044..68f6bfdc43 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -10450,6 +10450,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
Set_Node_Offset(ret, RExC_parse); /* MJD */
is_open = 1;
} else {
+ /* with RXf_PMf_NOCAPTURE treat (...) as (?:...) */
+ paren = ':';
ret = NULL;
}
}