Permalink
Browse files

Extend mruby stack when keep is bigger than room; fix #3421

But #3421 still cause stack overflow error due to infinite recursion.
To prevent overflow, we need to add different stack depth check.
  • Loading branch information...
matz committed Feb 13, 2017
1 parent ecb6ac8 commit 719f700adf7598d0ad910dcd3a94aad2ef354033
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/vm.c
View
@@ -169,6 +169,9 @@ stack_extend_alloc(mrb_state *mrb, int room, int keep)
static inline void
stack_extend(mrb_state *mrb, int room, int keep)
{
if (room < keep) {
room = keep;
}
if (mrb->c->stack + room >= mrb->c->stend) {
stack_extend_alloc(mrb, room, keep);
}

0 comments on commit 719f700

Please sign in to comment.