diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-08-18 22:17:33 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-08-18 22:17:33 +0900 |
| commit | 2adb0c201ed4df3abc6ec0bd984aa1b4c3b305ab (patch) | |
| tree | a71d90338387038c19fbd5f1c064b3d92801ca82 | |
| parent | 11c3ad999ed442e42a30a95f0211de326be10f85 (diff) | |
| parent | 6b0860ce61c2d3f8dbbd2646129ba28822b44b15 (diff) | |
| download | mruby-2adb0c201ed4df3abc6ec0bd984aa1b4c3b305ab.tar.gz mruby-2adb0c201ed4df3abc6ec0bd984aa1b4c3b305ab.zip | |
Merge pull request #3786 from christopheraue/3784_fix
Reset ci in OP_SUPER after potential realloc
| -rw-r--r-- | src/vm.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1333,7 +1333,7 @@ RETRY_TRY_BLOCK: int bidx = (argc < 0) ? a+2 : a+n+1; struct RProc *m; struct RClass *c; - mrb_callinfo *ci = mrb->c->ci; + mrb_callinfo *ci; mrb_value recv, blk; mrb_sym mid = syms[GETARG_B(i)]; @@ -1345,9 +1345,9 @@ RETRY_TRY_BLOCK: else { blk = regs[bidx]; if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) { - /* store the converted proc not directly in the stack because the stack - might have been reallocated during mrb_convert_type(), see #3622 */ blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc"); + /* The stack might have been reallocated during mrb_convert_type(), + see #3622 */ regs[bidx] = blk; } } @@ -1531,10 +1531,11 @@ RETRY_TRY_BLOCK: recv = regs[0]; blk = regs[bidx]; if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) { - /* store the converted proc not directly in the stack because the stack - might have been reallocated during mrb_convert_type(), see #3622 */ blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc"); + /* The stack or ci stack might have been reallocated during + mrb_convert_type(), see #3622 and #3784 */ regs[bidx] = blk; + ci = mrb->c->ci; } c = ci->target_class->super; m = mrb_method_search_vm(mrb, &c, mid); |
