Skip to content

Commit

Permalink
Limit ecall() recursion levels; fix #3466
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 4, 2017
1 parent ecee8c5 commit 3b40a2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ ecall(mrb_state *mrb, int i)
ptrdiff_t nstk;

if (i<0) return;
if (mrb->c->ci - mrb->c->cibase > MRB_FUNCALL_DEPTH_MAX) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err));
}
p = mrb->c->ensure[i];
if (!p) return;
if (mrb->c->ci->eidx > i)
Expand Down

0 comments on commit 3b40a2f

Please sign in to comment.