From 3d8c1a7e97521e73703e198d1383839c201787ec Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 11 Sep 2017 22:46:34 +0900 Subject: The ensure stack may be empty at `OP_EPOP`; fix 1st part of #3809 --- src/vm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/vm.c b/src/vm.c index 3b8119c67..ee5a0fd9e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1322,10 +1322,13 @@ RETRY_TRY_BLOCK: mrb_callinfo *ci, *nci; mrb_value self = regs[0]; - /* temporary limitation */ - mrb_assert(a==1); - proc = mrb->c->ensure[--mrb->c->eidx]; + mrb_assert(a==1); /* temporary limitation */ ci = mrb->c->ci; + if (mrb->c->eidx == ci->epos) { + NEXT; + } + + proc = mrb->c->ensure[--mrb->c->eidx]; nci = cipush(mrb); nci->mid = ci->mid; nci->argc = 0; -- cgit v1.2.3