diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-14 15:39:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-14 15:39:46 +0000 |
commit | e1646e639a14f8430046dd424c1b745bea7f9840 (patch) | |
tree | 689ae31d573520360c9d957056883e5d611d1f50 /array.c | |
parent | a8167d58b9c1b3cd3860e4e55cb98e7460337a00 (diff) | |
download | bundler-e1646e639a14f8430046dd424c1b745bea7f9840.tar.gz |
* array.c (ary_resize_capa): should not overwrite outside embedded
array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -163,7 +163,8 @@ ary_resize_capa(VALUE ary, long capacity) else { if (!ARY_EMBED_P(ary)) { long len = RARRAY_LEN(ary); - VALUE *ptr = RARRAY_PTR(ary); + VALUE *ptr = RARRAY_PTR(ary); + if (len > capacity) len = capacity; MEMCPY(RARRAY(ary)->as.ary, ptr, VALUE, len); FL_SET_EMBED(ary); ARY_SET_LEN(ary, len); |