Issue #9939 has been updated by Nobuyoshi Nakada.

Status changed from Assigned to Closed
% Done changed from 0 to 100

Applied in changeset r46418.

----------
array.c: combination on a shared copy

* array.c (rb_ary_combination): iterate on a shared copy, and use
  array of indexes instead of array of chosen objects.
  [ruby-core:63149] [Bug #9939]

----------------------------------------
Bug #9939: segfault by modifying array during Array#combination
https://bugs.ruby-lang.org/issues/9939#change-47207

* Author: Nobuyoshi Nakada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: core
* Target version: current: 2.2.0
* ruby -v: r46416
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
~~~ruby
$ ruby -e 'a = [*0..500]' -e 'a.combination(2) {|*,x| a.clear}'
-e:2: [BUG] Segmentation fault at 0x00000000000000
~~~



-- 
https://bugs.ruby-lang.org/