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

Merge pull request #3972 from take-cheeze/fix_ary_set_len_assert

Set array length after expanding capacity.
parents 1a8483f1 1218ff5d
......@@ -256,7 +256,6 @@ mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len)
ary_modify(mrb, a);
old_len = RARRAY_LEN(ary);
if (old_len != new_len) {
ARY_SET_LEN(a, new_len);
if (new_len < old_len) {
ary_shrink_capa(mrb, a);
}
......@@ -264,6 +263,7 @@ mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len)
ary_expand_capa(mrb, a, new_len);
ary_fill_with_nil(ARY_PTR(a) + old_len, new_len - old_len);
}
ARY_SET_LEN(a, new_len);
}
return ary;
......
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