summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-03-20 19:15:38 +0900
committerGitHub <noreply@github.com>2021-03-20 19:15:38 +0900
commite019dd24df4ed7063ad80d4c2e4070141793f598 (patch)
tree735ab507d758c25c95441dee16b7f35bca0009ea /array.c
parentbf3eaf39df9e0edc02040409b07bdd40b04bf8fa (diff)
Ensure the receiver is modifiable before shrinking [Bug #17736]
* Ensure the receiver is modifiable before shinking [Bug #17736] * Assert the receivers are not modified
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4296 Merged-By: nobu <nobu@ruby-lang.org>
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 2876548085..0f7ccdeb90 100644
--- a/array.c
+++ b/array.c
@@ -3846,6 +3846,7 @@ select_bang_ensure(VALUE a)
if (i2 < len && i2 < i1) {
long tail = 0;
+ rb_ary_modify(ary);
if (i1 < len) {
tail = len - i1;
RARRAY_PTR_USE_TRANSIENT(ary, ptr, {