diff options
author | David Mitchell <davem@iabyn.com> | 2023-01-18 13:52:26 +0000 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-02-28 20:53:51 +0800 |
commit | 504d203b2761303e5fba6cae79e35710d0618276 (patch) | |
tree | 9dddbc4b1ab3e1196bbbbc268e83920caffd0b5f /deb.c | |
parent | 043a585606181ef006e5a95043d7f1388c7b425d (diff) | |
download | perl-504d203b2761303e5fba6cae79e35710d0618276.tar.gz |
Perl_deb_stack_all() - handle empty CX stack
This function handles perl -Dsv, producing output like
STACK 0: MAIN
CX 0: BLOCK =>
CX 1: SUB => UNDEF PV("main"\0)
retop=leave
STACK 1: MAGIC
CX 0: SUB => IV(1)
When a CX stack had zero contexts pushed (like can sometimes happen
when something has just done a PUSHSTACKi() and no op has pushed a BLOCK
or SUB or whatever yet), then the code for determining where the next
markstack pointer is (by peeking ahead into the first CX of the next SI)
was accessing random garbage at cx[0]. This commit fixes that.
Diffstat (limited to 'deb.c')
-rw-r--r-- | deb.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -320,7 +320,10 @@ Perl_deb_stack_all(pTHX) } if (CxTYPE(&(si_n->si_cxstack[i])) == CXt_SUBST) continue; - cx_n = &(si_n->si_cxstack[i]); + if (si_n->si_cxix >= 0) + cx_n = &(si_n->si_cxstack[i]); + else + cx_n = NULL; break; } |