[#78949] [Ruby trunk Feature#13095] [PATCH] io.c (rb_f_syscall): remove deprecation notice — kosaki.motohiro@...
Issue #13095 has been updated by Motohiro KOSAKI.
3 messages
2017/01/03
[#78997] [Ruby trunk Bug#13110] Byte-based operations for String — shugo@...
Issue #13110 has been updated by Shugo Maeda.
3 messages
2017/01/06
[#79228] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150] — Eric Wong <normalperson@...>
naruse@ruby-lang.org wrote:
5 messages
2017/01/23
[#79511] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Eric Wong <normalperson@...>
2017/02/13
Eric Wong <normalperson@yhbt.net> wrote:
[#79518] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Nobuyoshi Nakada <nobu@...>
2017/02/13
On 2017/02/13 10:04, Eric Wong wrote:
[#79298] [Ruby trunk Bug#13085][Assigned] io.c io_fwrite creates garbage — nobu@...
Issue #13085 has been updated by Nobuyoshi Nakada.
3 messages
2017/01/29
[#79337] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write — SASADA Koichi <ko1@...>
Eric:
4 messages
2017/01/31
[#79352] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write
— Eric Wong <normalperson@...>
2017/01/31
SASADA Koichi <ko1@atdot.net> wrote:
[ruby-core:79092] [Ruby trunk Bug#12988] Calling `inspect` sometimes causes a segv
From:
nagachika00@...
Date:
2017-01-16 18:50:51 UTC
List:
ruby-core #79092
Issue #12988 has been updated by Tomoyuki Chikanaga.
Backport changed from 2.1: REQUIRED, 2.2: DONE, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE
ruby_2_3 r57341 merged revision(s) 56938.
----------------------------------------
Bug #12988: Calling `inspect` sometimes causes a segv
https://bugs.ruby-lang.org/issues/12988#change-62499
* Author: Aaron Patterson
* Status: Closed
* Priority: Normal
* Assignee: Aaron Patterson
* Target version:
* ruby -v: ruby 2.4.0dev (2016-10-05 tclass-heaps 56351) [x86_64-darwin16]
* Backport: 2.1: REQUIRED, 2.2: DONE, 2.3: DONE
----------------------------------------
`rb_obj_inspect` calls `rb_ivar_count ` to find the number of instance variables on an object. `rb_ivar_count` uses `tbl->num_entries` on the instance variable index table to determine how far in to the instance variable array it should read. Since the instance variable index table is shared, it may increase in size, but the instance variable array will not.
For example:
~~~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` share an IV index table. Calling `instance_variable_set` on `x` will increase the size of the IV index table. When `y.inspect` is called, the table size is larger than `ROBJECT_IVPTR` array for that instance. This means that sometimes calling inspect can segv as it may read memory it shouldn't.
I've attached a patch that fixes this by using the length of the array rather than the size of the IV index table.
---Files--------------------------------
0001-Stop-reading-past-the-end-of-ivptr-array.patch (1.33 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>