Commit 26926a1d authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1013 from takkaw/fix_bo_missing

fix segmentation fault in BasicObject#inspect
parents 618d7339 5aafbca0
......@@ -1139,10 +1139,15 @@ mrb_bob_missing(mrb_state *mrb, mrb_value mod)
mrb_raise(mrb, E_TYPE_ERROR, "name should be a symbol");
}
if (mrb_respond_to(mrb,mod,mrb_intern(mrb,"inspect"))){
inspect = mrb_funcall(mrb, mod, "inspect", 0);
if (RSTRING_LEN(inspect) > 64) {
inspect = mrb_any_to_s(mrb, mod);
}
}
else {
inspect = mrb_any_to_s(mrb, mod);
}
mrb_raisef(mrb, E_NOMETHOD_ERROR, "undefined method '%s' for %s",
mrb_sym2name(mrb, mrb_symbol(name)), RSTRING_PTR(inspect));
......
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