summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2005-05-21 22:10:19 +0000
committerDave Mitchell <davem@fdisolutions.com>2005-05-21 22:10:19 +0000
commit5eff7df71d0d0bb7c87e225c00e2091ae2433cb9 (patch)
tree0bb0b3bd9078269ebea26f546fa5b74647f739cd /pp_ctl.c
parent2d43a17f6a49532750d0e6ce2814b523e2f19999 (diff)
downloadperl-5eff7df71d0d0bb7c87e225c00e2091ae2433cb9.tar.gz
[perl #35878] goto &xsub that croaks corrupts memory
When an XS sub is called, a CxSUB context shouldn't be pushed. Make goto &xs_sub mimic this behaviour by first popping the old CxSUB p4raw-id: //depot/perl@24535
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index bb8aab7833..0eac63ef59 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2343,6 +2343,7 @@ PP(pp_goto)
SAVETMPS;
SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
if (CvXSUB(cv)) {
+ OP* retop = cx->blk_sub.retop;
if (reified) {
I32 index;
for (index=0; index<items; index++)
@@ -2367,17 +2368,15 @@ PP(pp_goto)
SV **newsp;
I32 gimme;
+ /* XS subs don't have a CxSUB, so pop it */
+ POPBLOCK(cx, PL_curpm);
/* Push a mark for the start of arglist */
PUSHMARK(mark);
PUTBACK;
(void)(*CvXSUB(cv))(aTHX_ cv);
- /* Pop the current context like a decent sub should */
- POPBLOCK(cx, PL_curpm);
- /* Do _not_ use PUTBACK, keep the XSUB's return stack! */
}
LEAVE;
- assert(CxTYPE(cx) == CXt_SUB);
- return cx->blk_sub.retop;
+ return retop;
}
else {
AV* padlist = CvPADLIST(cv);