Avoid crashing of `Array#unshift`; fix
On cases like `a.unshift(*a)`.
@@ -631,11 +631,13 @@ mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
ptr = a->as.heap.ptr;
}
else {
+ mrb_bool same = vals == ARY_PTR(a);
ary_modify(mrb, a);
if (ARY_CAPA(a) < len + alen)
ary_expand_capa(mrb, a, len + alen);
ptr = ARY_PTR(a);
value_move(ptr + alen, ptr, len);
+ if (same) vals = ptr;
}
array_copy(ptr, vals, alen);
ARY_SET_LEN(a, len+alen);
