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.
parent ecb6ac8b
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment