Check call depth when mrb_yield_class() is called; ref #3521

parent 75c374ca
...@@ -668,6 +668,9 @@ mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value ...@@ -668,6 +668,9 @@ mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value
if (mrb_nil_p(b)) { if (mrb_nil_p(b)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given"); mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
} }
if (mrb->c->ci - mrb->c->cibase > MRB_FUNCALL_DEPTH_MAX) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err));
}
p = mrb_proc_ptr(b); p = mrb_proc_ptr(b);
ci = cipush(mrb); ci = cipush(mrb);
ci->mid = mid; ci->mid = mid;
......
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