Unverified Commit 0030417a authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5305 from dearblue/symbol0

Check first `0` when converting symbols into strings
parents bb42c1b2 3d8a8fb6
......@@ -303,6 +303,7 @@ mrb_check_intern_str(mrb_state *mrb, mrb_value str)
static const char*
sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
{
if (sym == 0) goto outofsym;
if (SYMBOL_INLINE_P(sym)) return sym_inline_unpack(sym, buf, lenp);
#ifndef MRB_NO_PRESYM
......@@ -313,7 +314,8 @@ sym2name_len(mrb_state *mrb, mrb_sym sym, char *buf, mrb_int *lenp)
#endif
sym -= MRB_PRESYM_MAX;
if (sym == 0 || mrb->symidx < sym) {
if (mrb->symidx < sym) {
outofsym:
if (lenp) *lenp = 0;
return NULL;
}
......
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