summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-09-01 16:59:03 +0100
committerDavid Mitchell <davem@iabyn.com>2010-09-01 17:08:46 +0100
commitf427b557f0f598ee6ff57dfc24080cf33d959242 (patch)
tree823b0b103416760b33d52b0131662d394bae3034 /pp_hot.c
parent8ebb9810247974cb36d9fc84f30cf667c36e141e (diff)
downloadperl-f427b557f0f598ee6ff57dfc24080cf33d959242.tar.gz
Copy RE capture buf on overload as well as TEMP
Partial fix for [perl #77084]. Sometimes pp_match makes a copy of the original SV's string for the later use of $1 et al; in particular if the SV is TEMP (so will soon go away). Make it do the same if the SV is overloaded, as the string return is most certainly temporary! (Also tweak the tests to make them more likely to fail on badness by creating new stings that will likely reallocate freed buffer).
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 02f425aa41..25a804a123 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1336,7 +1336,7 @@ PP(pp_match)
appears to be quite tricky.
Test for the unsafe vars are TODO for now. */
if (( !global && RX_NPARENS(rx))
- || SvTEMP(TARG) || PL_sawampersand ||
+ || SvTEMP(TARG) || SvAMAGIC(TARG) || PL_sawampersand ||
(RX_EXTFLAGS(rx) & (RXf_EVAL_SEEN|RXf_PMf_KEEPCOPY)))
r_flags |= REXEC_COPY_STR;
if (SvSCREAM(TARG))