Permalink
Browse files

Fixed out-of-bounds access of `ensure[]`; ref #3491

  • Loading branch information...
matz committed Apr 3, 2017
1 parent b8461c8 commit ab63ee61ca2c130907d68d656ff7486ec2d29db8
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/vm.c
View
@@ -1142,7 +1142,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
p = mrb_closure_new(mrb, irep->reps[GETARG_Bx(i)]);
/* push ensure_stack */
if (mrb->c->esize <= mrb->c->ci->eidx) {
if (mrb->c->esize <= mrb->c->ci->eidx+1) {
if (mrb->c->esize == 0) mrb->c->esize = 16;
else mrb->c->esize *= 2;
mrb->c->ensure = (struct RProc **)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*) * mrb->c->esize);

0 comments on commit ab63ee6

Please sign in to comment.