diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-26 23:21:26 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-27 00:13:07 -0700 |
commit | 25375124d2a06f2525e94c98c36eea007026778e (patch) | |
tree | 1fb76629bd05b31c30dfcda892fbbfcd4288f17b /pp_hot.c | |
parent | 31d073689e2b5fa63aa7d4f8aaf529f75eeb5d0e (diff) | |
download | perl-25375124d2a06f2525e94c98c36eea007026778e.tar.gz |
[perl #119311] Keep CvDEPTH and savestack in sync
when unwinding sub and format calls.
The comments in the added test file explain what the problem is.
The fix is to call LEAVE_SCOPE in POPSUB and POPFORMAT (to free their
lexicals) before lowering CvDEPTH.
If the context has already been popped via cxstack_ix--, then
LEAVE_SCOPE could overwrite it, so accessing cx after LEAVE_SCOPE is
unsafe. Hence the changes to POPSUB and POPFORMAT are a bit involved.
Some callers of POPSUB do a temporary cxstack_ix++ first so they
can access cx afterwards. Two cases needed to be changed to
work that way.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2510,8 +2510,8 @@ PP(pp_leavesub) PUTBACK; LEAVE; - cxstack_ix--; POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */ + cxstack_ix--; PL_curpm = newpm; /* ... and pop $1 et al */ LEAVESUB(sv); |