[ruby-cvs:64285] rhe:r57119 (trunk): array.c: check array length every time after yielding

rhe at ruby-lang.org rhe at ruby-lang.org
Tue Dec 20 14:26:08 JST 2016


rhe	2016-12-20 14:26:08 +0900 (Tue, 20 Dec 2016)

  New Revision: 57119

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57119

  Log:
    array.c: check array length every time after yielding
    
    Since the Array may be modified during rb_yield(), the length before
    invoking the block can't be trusted. Fix possible out-of-bounds read in
    Array#combination and Array#repeated_combination.
    
    It may better to make a defensive copy of the Array, but for now let's
    follow what Array#permutation does.  [ruby-core:78738] [Bug #13052]

  Modified files:
    trunk/array.c
    trunk/test/ruby/test_array.rb


More information about the ruby-cvs mailing list