summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 10:58:49 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-31 10:58:49 +0000
commitc7dfe6077fbc61ee396e67f89bf566298dbdc3e7 (patch)
treee634475097d7666e527ddd6cc892de279fc6393b /array.c
parent6d7cab3bd6db434f8299c1ef52aa62a92129f41b (diff)
merge revision(s) 66756: [Backport #15479]
Mark array as "going to be modified" in `Array#reject!` Before this patch, if `reject!` is called on a shared array it can mutate the shared array rather than a copy. This patch marks the array as "going to be modified" so that the shared source array isn't mutated. [Bug #15479] [ruby-core:90781] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@66966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/array.c b/array.c
index 35c63fe857..c33eba63b9 100644
--- a/array.c
+++ b/array.c
@@ -3218,6 +3218,7 @@ static VALUE
rb_ary_reject_bang(VALUE ary)
{
RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
+ rb_ary_modify(ary);
return ary_reject_bang(ary);
}