Should check if `callinfo` stack is popped before updating the stack.

This is a resurrection of 75c374ca, which is accidentally removed by
93f5f225; Fix #3507 #3512 #3518 #3521
parent c7c9543b
...@@ -1845,10 +1845,11 @@ RETRY_TRY_BLOCK: ...@@ -1845,10 +1845,11 @@ RETRY_TRY_BLOCK:
} }
if (mrb->exc) { if (mrb->exc) {
mrb_callinfo *ci0;
mrb_value *stk; mrb_value *stk;
L_RAISE: L_RAISE:
ci = mrb->c->ci; ci0 = ci = mrb->c->ci;
if (ci == mrb->c->cibase) { if (ci == mrb->c->cibase) {
if (ci->ridx == 0) goto L_FTOP; if (ci->ridx == 0) goto L_FTOP;
goto L_RESCUE; goto L_RESCUE;
...@@ -1900,7 +1901,9 @@ RETRY_TRY_BLOCK: ...@@ -1900,7 +1901,9 @@ RETRY_TRY_BLOCK:
irep = proc->body.irep; irep = proc->body.irep;
pool = irep->pool; pool = irep->pool;
syms = irep->syms; syms = irep->syms;
if (ci < ci0) {
mrb->c->stack = ci[1].stackent; mrb->c->stack = ci[1].stackent;
}
stack_extend(mrb, irep->nregs); stack_extend(mrb, irep->nregs);
pc = mrb->c->rescue[--ci->ridx]; pc = mrb->c->rescue[--ci->ridx];
} }
......
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