Need more precise constant name check.

This change was inspired by [ruby-bugs#7573]
parent c2634e18
......@@ -1981,7 +1981,14 @@ mrb_mod_const_get(mrb_state *mrb, mrb_value mod)
end = (end == -1) ? len : end;
id = mrb_intern(mrb, ptr+off, end-off);
mod = mrb_const_get_sym(mrb, mod, id);
off = (end == len) ? end : end+2;
if (end == len)
off = end;
else {
off = end + 2;
if (off == len) { /* trailing "::" */
mrb_name_error(mrb, id, "wrong constant name '%S'", path);
}
}
}
return mod;
......
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