Skip to content

Commit

Permalink
Protect stack region before calling mrb_convert_type(); fix #3504
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 16, 2017
1 parent f8b31a0 commit b64f087
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b64f087

Please sign in to comment.