diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-30 08:04:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-30 08:04:27 +0900 |
| commit | d3e273ba4e6a7bc3d297c6f4b49aca0ebc4495c5 (patch) | |
| tree | 6d3f0a5f7cd345530cc9aa186255eeb1ec3aaafc /src/vm.c | |
| parent | f3279b41e6441f9b4032cad79d984218cf47703d (diff) | |
| download | mruby-d3e273ba4e6a7bc3d297c6f4b49aca0ebc4495c5.tar.gz mruby-d3e273ba4e6a7bc3d297c6f4b49aca0ebc4495c5.zip | |
Wrong stack adjustment in `ecall()` (f35f975 #3859); fix #3862
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -316,6 +316,7 @@ ecall(mrb_state *mrb) ptrdiff_t cioff; int ai = mrb_gc_arena_save(mrb); int i = --c->eidx; + int nregs; if (i<0) return; if (ci - c->cibase > MRB_FUNCALL_DEPTH_MAX) { @@ -325,7 +326,7 @@ ecall(mrb_state *mrb) if (!p) return; mrb_assert(!MRB_PROC_CFUNC_P(p)); c->ensure[i] = NULL; - c->stack += ci->proc->body.irep->nregs; + nregs = ci->proc->body.irep->nregs; cioff = ci - c->cibase; ci = cipush(mrb); ci->stackent = mrb->c->stack; @@ -335,6 +336,7 @@ ecall(mrb_state *mrb) ci->proc = p; ci->nregs = p->body.irep->nregs; ci->target_class = MRB_PROC_TARGET_CLASS(p); + c->stack += nregs; env = MRB_PROC_ENV(p); mrb_assert(env); exc = mrb->exc; mrb->exc = 0; |
