The ensure clause should keep its ci after its execution; fix #3406

This issue was reported by https://hackerone.com/ston3
parent 324887d0
......@@ -280,12 +280,14 @@ ecall(mrb_state *mrb, int i)
mrb_callinfo *ci;
mrb_value *self = mrb->c->stack;
struct RObject *exc;
int cioff;
if (i<0) return;
p = mrb->c->ensure[i];
if (!p) return;
if (mrb->c->ci->eidx > i)
mrb->c->ci->eidx = i;
cioff = mrb->c->ci - mrb->c->cibase;
ci = cipush(mrb);
ci->stackent = mrb->c->stack;
ci->mid = ci[-1].mid;
......@@ -298,6 +300,7 @@ ecall(mrb_state *mrb, int i)
exc = mrb->exc; mrb->exc = 0;
mrb_run(mrb, p, *self);
mrb->c->ensure[i] = NULL;
mrb->c->ci = mrb->c->cibase + cioff;
if (!mrb->exc) mrb->exc = exc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment