Skip to content

Commit

Permalink
Stack may be reallocated in mrb_run(); fix #3465
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 27, 2017
1 parent 736be0e commit 9e93d5d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ ecall(mrb_state *mrb, int i)
mrb_value *self = mrb->c->stack;
struct RObject *exc;
int cioff;
mrb_value *nstk;
ptrdiff_t nstk;

if (i<0) return;
p = mrb->c->ensure[i];
Expand All @@ -298,7 +298,7 @@ ecall(mrb_state *mrb, int i)
mrb->c->ci->eidx = i;
cioff = mrb->c->ci - mrb->c->cibase;
ci = cipush(mrb);
nstk = ci->stackent;
nstk = ci->stackent - mrb->c->stbase;
ci->stackent = mrb->c->stack;
ci->mid = ci[-1].mid;
ci->acc = CI_ACC_SKIP;
Expand All @@ -310,7 +310,7 @@ ecall(mrb_state *mrb, int i)
exc = mrb->exc; mrb->exc = 0;
mrb_run(mrb, p, *self);
mrb->c->ensure[i] = NULL;
ci->stackent = nstk;
ci->stackent = mrb->c->stbase + nstk;
mrb->c->ci = mrb->c->cibase + cioff;
if (!mrb->exc) mrb->exc = exc;
}
Expand Down

0 comments on commit 9e93d5d

Please sign in to comment.