Skip to content

Commit

Permalink
vm.c: vm.c: stack may be reallocated in functions calls; aaa28a5
Browse files Browse the repository at this point in the history
`mrb_range_new()` also calls VM recursively.
  • Loading branch information
matz committed Mar 26, 2022
1 parent bf5bbf0 commit 7f5a490
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/vm.c
Expand Up @@ -2819,13 +2819,15 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc)
}

CASE(OP_RANGE_INC, B) {
regs[a] = mrb_range_new(mrb, regs[a], regs[a+1], FALSE);
mrb_value v = mrb_range_new(mrb, regs[a], regs[a+1], FALSE);
regs[a] = v;
mrb_gc_arena_restore(mrb, ai);
NEXT;
}

CASE(OP_RANGE_EXC, B) {
regs[a] = mrb_range_new(mrb, regs[a], regs[a+1], TRUE);
mrb_value v = mrb_range_new(mrb, regs[a], regs[a+1], TRUE);
regs[a] = v;
mrb_gc_arena_restore(mrb, ai);
NEXT;
}
Expand Down

0 comments on commit 7f5a490

Please sign in to comment.