Restrict recursion levels in method_missing(); fix #3556

Note this is a temporary fix. Error message generation
(including `inspect`) should be deferred until its use.
parent d27a3d47
...@@ -922,7 +922,7 @@ mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args) ...@@ -922,7 +922,7 @@ mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args)
/* method missing in inspect; avoid recursion */ /* method missing in inspect; avoid recursion */
repr = mrb_any_to_s(mrb, self); repr = mrb_any_to_s(mrb, self);
} }
else if (mrb_respond_to(mrb, self, inspect) && mrb->c->ci - mrb->c->cibase < 64) { else if (mrb_respond_to(mrb, self, inspect) && mrb->c->ci - mrb->c->cibase < 16) {
repr = mrb_funcall_argv(mrb, self, inspect, 0, 0); repr = mrb_funcall_argv(mrb, self, inspect, 0, 0);
if (mrb_string_p(repr) && RSTRING_LEN(repr) > 64) { if (mrb_string_p(repr) && RSTRING_LEN(repr) > 64) {
repr = mrb_any_to_s(mrb, self); repr = mrb_any_to_s(mrb, self);
......
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