aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/array.c b/array.c
index 46f37944a0..f3f1b2e960 100644
--- a/array.c
+++ b/array.c
@@ -797,8 +797,10 @@ rb_ary_store(VALUE ary, long idx, VALUE val)
ary_double_capa(ary, idx);
}
if (idx > RARRAY_LEN(ary)) {
- rb_mem_clear(RARRAY_PTR(ary) + RARRAY_LEN(ary),
+ RARRAY_PTR_USE(ary, ptr, {
+ rb_mem_clear(ptr + RARRAY_LEN(ary),
idx-RARRAY_LEN(ary) + 1);
+ });
}
if (idx >= RARRAY_LEN(ary)) {