summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2021-02-08 14:47:18 +0000
committerHugo van der Sanden <hv@crypt.org>2021-02-08 14:48:21 +0000
commit5fa8d5db906c2b647f6651b061de02e805d898a1 (patch)
tree7e498e94efe3594a97e0bae2435a84a68f9c7305 /pp_ctl.c
parent68a78eaf3cbe46ade1a60fb66a01e24ee02f00ee (diff)
downloadperl-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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 9e440dcd9b..6ef2ba17bb 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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);