diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-22 14:05:11 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-11-22 14:05:11 +0900 |
| commit | 0ab21a9a5e487a0d50988adb5d6c4114364acd3d (patch) | |
| tree | 2b1d826bd6d489cd24a2822cd56042be5c47ba53 /src | |
| parent | fbafa780983d2e37b2563f52aa068614fdf0bedc (diff) | |
| download | mruby-0ab21a9a5e487a0d50988adb5d6c4114364acd3d.tar.gz mruby-0ab21a9a5e487a0d50988adb5d6c4114364acd3d.zip | |
Stack adjustment should be based on `p->upper`; fix #3857
It used to be based on `ci->proc` but the callinfo position may be
wrong when `ecall()` is called during stack rewinding from `OP_RETURN`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -309,7 +309,6 @@ static void ecall(mrb_state *mrb) { struct RProc *p; - int nregs; struct mrb_context *c = mrb->c; mrb_callinfo *ci = c->ci; struct RObject *exc; @@ -325,7 +324,6 @@ ecall(mrb_state *mrb) p = c->ensure[i]; if (!p) return; mrb_assert(!MRB_PROC_CFUNC_P(p)); - nregs = ci->proc->body.irep->nregs; c->ensure[i] = NULL; cioff = ci - c->cibase; ci = cipush(mrb); @@ -338,7 +336,7 @@ ecall(mrb_state *mrb) ci->target_class = MRB_PROC_TARGET_CLASS(p); env = MRB_PROC_ENV(p); mrb_assert(env); - c->stack += nregs; + c->stack += p->upper->body.irep->nregs; exc = mrb->exc; mrb->exc = 0; if (exc) { mrb_gc_protect(mrb, mrb_obj_value(exc)); |
