Avoid using 'mrb_str_new_static` if a symbol is packed; fix #4342

This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-03-27 12:53:24 +09:00
parent 5598612336
commit b8f00e439d
+4
View File
@@ -325,6 +325,10 @@ mrb_sym_to_s(mrb_state *mrb, mrb_value sym)
mrb_int len;
p = mrb_sym2name_len(mrb, id, &len);
#ifndef MRB_ENABLE_SYMBOLL_ALL
if (p == mrb->symbuf)
return mrb_str_new(mrb, p, len);
#endif
return mrb_str_new_static(mrb, p, len);
}