[ruby-cvs:64507] nagachika:r57341 (ruby_2_3): merge revision(s) 56938: [Backport #12988]

nagachika at ruby-lang.org nagachika at ruby-lang.org
Tue Jan 17 03:50:47 JST 2017


nagachika	2017-01-17 03:50:47 +0900 (Tue, 17 Jan 2017)

  New Revision: 57341

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

  Log:
    merge revision(s) 56938: [Backport #12988]
    
    Stop reading past the end of `ivptr` array
    
    If you have code like this:
    
    ```ruby
    class A
      def initialize
        @a = nil
        @b = nil
        @c = nil
        @d = nil
        @e = nil
      end
    end
    
    x = A.new
    y = x.clone
    100.times { |z| x.instance_variable_set(:"@foo#{z}", nil) }
    puts y.inspect
    ```
    
    `x` and `y` will share `iv_index_tbl` hashes.  However, the size of the
    hash will grow larger than the number if entries in `ivptr` in `y`.
    Before this commit, `rb_ivar_count` would use the size of the hash to
    determine how far to read in to the array, but this means that it could
    read past the end of the array and cause the program to segv
    
    [ruby-core:78403]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/variable.c
    branches/ruby_2_3/version.h


More information about the ruby-cvs mailing list