Permalink
Browse files

Add missing regs update

mrb_vm_define_class() may realloc() mrb->c->stack because it calls
mrb_funcall() for inherited hook. If mrb->c->stack is realloc()-ed, regs
refers orphan address.
  • Loading branch information...
kou committed Mar 24, 2016
1 parent dd072b5 commit c69cba2ad97c311d1ae72c8a77cf1e57d70d694f
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/vm.c
View
@@ -2271,6 +2271,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
base = mrb_obj_value(mrb->c->ci->target_class);
}
c = mrb_vm_define_class(mrb, base, super, id);
regs = mrb->c->stack;
regs[a] = mrb_obj_value(c);
ARENA_RESTORE(mrb, ai);
NEXT;

0 comments on commit c69cba2

Please sign in to comment.