Fix mrb_ary_splat to copy the array; fix #5067

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-08-29 18:42:09 +09:00
parent 96bae1d508
commit a66d86cfc1
+3 -1
View File
@@ -1081,7 +1081,9 @@ mrb_ary_splat(mrb_state *mrb, mrb_value v)
mrb_value a;
if (mrb_array_p(v)) {
return v;
struct RArray *a = mrb_ary_ptr(v);
a = ary_dup(mrb, a);
return mrb_obj_value(a);
}
if (!mrb_respond_to(mrb, v, mrb_intern_lit(mrb, "to_a"))) {