From e019dd24df4ed7063ad80d4c2e4070141793f598 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 20 Mar 2021 19:15:38 +0900 Subject: Ensure the receiver is modifiable before shrinking [Bug #17736] * Ensure the receiver is modifiable before shinking [Bug #17736] * Assert the receivers are not modified --- array.c | 1 + 1 file changed, 1 insertion(+) (limited to 'array.c') 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, { -- cgit v1.2.3