summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRobin Houston <robin@cpan.org>1998-02-24 11:15:57 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-02-25 15:28:08 +0000
commitb150fb22188cba2cc0808878ec299d4f0e8c70ea (patch)
treea87afff175ea5156e2cdc208e8cf4fe694e96f18 /pp_ctl.c
parent0fa190096f28eaa3c2a08a9aa7c333cd24617fd7 (diff)
downloadperl-b150fb22188cba2cc0808878ec299d4f0e8c70ea.tar.gz
Re: [PATCH 5.004_60] Fix goto-in-eval segfault (unwrapped!)
p4raw-id: //depot/perl@582
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 2cfe854893..9753fcfa76 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1722,8 +1722,11 @@ PP(pp_goto)
if (cxix < cxstack_ix)
dounwind(cxix);
TOPBLOCK(cx);
+ if (cx->cx_type == CXt_EVAL && cx->blk_eval.old_op_type == OP_ENTEREVAL)
+ DIE("Can't goto subroutine from an eval-string");
mark = stack_sp;
- if (cx->blk_sub.hasargs) { /* put @_ back onto stack */
+ if (cx->cx_type == CXt_SUB &&
+ cx->blk_sub.hasargs) { /* put @_ back onto stack */
AV* av = cx->blk_sub.argarray;
items = AvFILLp(av) + 1;
@@ -1738,7 +1741,8 @@ PP(pp_goto)
AvREAL_off(av);
av_clear(av);
}
- if (!(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth))
+ if (cx->cx_type == CXt_SUB &&
+ !(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth))
SvREFCNT_dec(cx->blk_sub.cv);
oldsave = scopestack[scopestack_ix - 1];
LEAVE_SCOPE(oldsave);
@@ -1768,6 +1772,12 @@ PP(pp_goto)
else {
AV* padlist = CvPADLIST(cv);
SV** svp = AvARRAY(padlist);
+ if (cx->cx_type == CXt_EVAL) {
+ in_eval = cx->blk_eval.old_in_eval;
+ eval_root = cx->blk_eval.old_eval_root;
+ cx->cx_type = CXt_SUB;
+ cx->blk_sub.hasargs = 0;
+ }
cx->blk_sub.cv = cv;
cx->blk_sub.olddepth = CvDEPTH(cv);
CvDEPTH(cv)++;