summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-13 13:10:15 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-13 13:42:41 -0700
commit3455055faace06645b99a6ed63fce90144ab47e1 (patch)
tree9350e2e775578481c8b6801d3714d4241e4cf90b /pp_hot.c
parent4b567c50428833d40192718a32cf4ef48d410d4a (diff)
downloadperl-3455055faace06645b99a6ed63fce90144ab47e1.tar.gz
Copy PADTMPS passed to XSUBs
This resolves the last remaining issue in ticket #78194, that newRV is supposedly buggy because it doesn’t copy its referent. The full implications of the PADTMP are not explained anywhere in the API docs, and even XSUBs shouldn’t have to worry about special handling. (E.g., what if they do SvREFCNT_dec(SvRV(sv)); SvRV(sv)=...?) So the real solution here is not to let XSUBs see them.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 3adeb1e8f7..b08643fcc1 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2727,6 +2727,15 @@ try_autoload:
PUTBACK ;
}
}
+ else {
+ SV **mark = PL_stack_base + markix;
+ I32 items = SP - mark;
+ while (items--) {
+ mark++;
+ if (*mark && SvPADTMP(*mark) && !IS_PADGV(*mark))
+ *mark = sv_mortalcopy(*mark);
+ }
+ }
/* We assume first XSUB in &DB::sub is the called one. */
if (PL_curcopdb) {
SAVEVPTR(PL_curcop);