Permalink
Browse files

Protect stack region before calling mrb_convert_type(); fix #3504

  • Loading branch information...
matz committed Mar 16, 2017
1 parent f8b31a0 commit b64f08784cc50861dec80c26fce715982c02c9e9
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/vm.c
View
@@ -1207,6 +1207,7 @@ 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) {
ci->nregs = bidx+1;
regs[bidx] = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
}
}
@@ -1438,6 +1439,7 @@ 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) {
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 b64f087

Please sign in to comment.