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

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-03-19 00:21:53 +09:00
parent 75c374cad3
commit 2cbbeba0e0
+3
View File
@@ -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)) {
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);
ci = cipush(mrb);
ci->mid = mid;