Project

General

Profile

Bug #9939

segfault by modifying array during Array#combination

Added by nobu (Nobuyoshi Nakada) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
r46416
[ruby-core:63149]

Description

$ ruby -e 'a = [*0..500]' -e 'a.combination(2) {|*,x| a.clear}'
-e:2: [BUG] Segmentation fault at 0x00000000000000

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • 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]

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

r46417 and r46418 were backported into ruby_2_1 branch at r46808.

Updated by usa (Usaku NAKAMURA) about 6 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into ruby_2_0_0 at r47332.

Also available in: Atom PDF