Permalink
Browse files

Extend VM stack just in case; ref #3551

  • Loading branch information...
matz committed Apr 1, 2017
1 parent 071164b commit 93d802987e722444d0520a8d3f28002841c4f825
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/vm.c
View
@@ -1202,8 +1202,10 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
else {
mrb_value blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if(bidx >= mrb->c->ci->nregs)
if(bidx >= mrb->c->ci->nregs) {
stack_extend(mrb, bidx+1, mrb->c->ci->nregs);
mrb->c->ci->nregs = bidx+1;
}
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
}
@@ -1439,8 +1441,10 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
}
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if(bidx >= ci->nregs)
if(bidx >= ci->nregs) {
stack_extend(mrb, bidx+1, ci->nregs);
ci->nregs = bidx+1;
}
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
ci = mrb->c->ci;
}

0 comments on commit 93d8029

Please sign in to comment.