diff options
author | Hugo van der Sanden <hv@crypt.org> | 2021-02-08 14:47:18 +0000 |
---|---|---|
committer | Hugo van der Sanden <hv@crypt.org> | 2021-02-08 14:48:21 +0000 |
commit | 5fa8d5db906c2b647f6651b061de02e805d898a1 (patch) | |
tree | 7e498e94efe3594a97e0bae2435a84a68f9c7305 /pp_ctl.c | |
parent | 68a78eaf3cbe46ade1a60fb66a01e24ee02f00ee (diff) | |
download | perl-5fa8d5db906c2b647f6651b061de02e805d898a1.tar.gz |
[gh18540] Don't read before start of context stack in pp_return()
Add a guard to the chunk introduced by a1325b902d for "try" support.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2487,11 +2487,13 @@ PP(pp_return) I32 cxix = dopopto_cursub(); again: - cx = &cxstack[cxix]; - if(CxTRY(cx)) { - /* This was a try {}. keep going */ - cxix = dopoptosub_at(cxstack, cxix - 1); - goto again; + if (cxix >= 0) { + cx = &cxstack[cxix]; + if (CxTRY(cx)) { + /* This was a try {}. keep going */ + cxix = dopoptosub_at(cxstack, cxix - 1); + goto again; + } } assert(cxstack_ix >= 0); |