Fixed heap buffer overflow in `mrb_ary_unshift_m`; fix #3760

parent 36dbfd9b
......@@ -584,8 +584,8 @@ mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
}
array_copy(ptr, vals, alen);
ARY_SET_LEN(a, len+alen);
while (len--) {
mrb_field_write_barrier_value(mrb, (struct RBasic*)a, vals[len]);
while (alen--) {
mrb_field_write_barrier_value(mrb, (struct RBasic*)a, vals[alen]);
}
return self;
......
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