Permalink
Browse files

Check env stack length before `OP_SETUPVAR`; ref #3643

  • Loading branch information...
matz committed May 25, 2017
1 parent e969229 commit e0931126ffcfd13af42c0a7ce4a37cc73f4223da
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/vm.c
View
@@ -1084,8 +1084,11 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
if (e) {
mrb_value *regs_a = regs + GETARG_A(i);
int idx = GETARG_B(i);
e->stack[idx] = *regs_a;
mrb_write_barrier(mrb, (struct RBasic*)e);
if (idx < MRB_ENV_STACK_LEN(e)) {
e->stack[idx] = *regs_a;
mrb_write_barrier(mrb, (struct RBasic*)e);
}
}
NEXT;
}

0 comments on commit e093112

Please sign in to comment.