[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-cvs
Subject: [ruby-cvs:64104] tenderlove:r56938 (trunk): Stop reading past the end of `ivptr` array
From: tenderlove () ruby-lang ! org
Date: 2016-11-29 17:06:35
Message-ID: 20161129170635.E310562F12 () svn ! ruby-lang ! org
[Download RAW message or body]
tenderlove 2016-11-30 02:06:35 +0900 (Wed, 30 Nov 2016)
New Revision: 56938
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56938
Log:
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 files:
trunk/variable.c
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic