From: "Eregon (Benoit Daloze)" Date: 2013-07-18T20:25:53+09:00 Subject: [ruby-core:56078] [ruby-trunk - Bug #8654] SEGV in Array#count Issue #8654 has been updated by Eregon (Benoit Daloze). Glass_saga (Masaki Matsushita) wrote: > > What do you think of this patch? > > I already fixed it on r42040, but this ticket hasn't been closed because I have commited it with wrong commit message. > It's my fault. > > However, I will add your test code. > Thank you for your patch, Ah, I should have looked the newest commits. It might be worth adding the second change to avoid the pointer loop (seems about the only one in array.c), RARRAY_PTR() is kind of deprecated with the new GC for these cases in core. I will commit it as I can rebase easily if it is OK. ---------------------------------------- Bug #8654: SEGV in Array#count https://bugs.ruby-lang.org/issues/8654#change-40572 Author: Glass_saga (Masaki Matsushita) Status: Assigned Priority: Normal Assignee: Glass_saga (Masaki Matsushita) Category: core Target version: current: 2.1.0 ruby -v: ruby 2.1.0dev (2013-07-18 trunk 42039) [x86_64-linux] Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED Following code causes SEGV. a1 = [] a2 = Array.new(100) {|i| i } a2.count do |i| p i a2.replace(a1) if i == 0 end -- http://bugs.ruby-lang.org/