[#61822] Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...>

I would like to request developers meeting around April 17 or 18 in this mo=

14 messages 2014/04/03
[#61825] Re: Plan Developers Meeting Japan April 2014 — Urabe Shyouhei <shyouhei@...> 2014/04/03

It's good if we have a meeting then.

[#61826] Re: Plan Developers Meeting Japan April 2014 — Zachary Scott <e@...> 2014/04/03

Regarding openssl issues, I=E2=80=99ve discussed possible meeting time with=

[#61833] Re: Plan Developers Meeting Japan April 2014 — Martin Bo煬et <martin.bosslet@...> 2014/04/03

Hi,

[ruby-core:61803] [ruby-trunk - Bug #9683] Segmentation fault when using default proc feature in ruby Hash object

From: sam.rawlins@...
Date: 2014-04-01 19:23:31 UTC
List: ruby-core #61803
Issue #9683 has been updated by Sam Rawlins.

File 9683.patch added

Currently, trunk act's like Eran's example: `a[1]` first results in SystemS=
tackError, then results  in segmentation fault. I've tracked the segfault d=
own to vm.c, in `vm_exec()`:

    1327  vm_loop_start:
    1328      result =3D vm_exec_core(th, initial);
    1329      if ((state =3D th->state) !=3D 0) {

I _do_ see that we get to line 1328, but I don't think we actually enter `v=
m_exec_core()`. My debugging abilities end there :(

In any case, maybe this should be solved like #9151 : cut it off and return=
 nil if recursion is detected. I've attached a small patch with tests.

This patch prevents the simple SystemStackError case, and permits some legi=
timate recursion, like in Psych's `yaml_tree.rb`:

    @dispatch_cache =3D Hash.new do |h,klass|
      method =3D "visit_#{(klass.name || '').split('::').join('_')}"
      method =3D respond_to?(method) ? method : h[klass.superclass]
      raise(TypeError, "Can't dump #{target.class}") unless method
      h[klass] =3D method
    end

 It also permits creative recursive uses of the default block:

    fac =3D Hash.new {|h,k| h[k] =3D h[k-1]*k }; fac[1] =3D 1
    fac[10]  #=3D> 3628800 =3D=3D 10 factorial
    fib =3D Hash.new {|h,k| h[k] =3D h[k-2] + h[k-1] }; fib[1] =3D fib[2] =
=3D 1
    fib[10]  #=3D> 55, the 10th Fibonacci number
    collatz =3D Hash.new {|h,k| h[k] =3D k.even? ? h[k/2] + 1 : h[3*k+1] + =
1 }
    collatz[1] =3D collatz[2] =3D collatz[4] =3D 0
    collatz[7]  #=3D> 14, the # of Collatz sequence steps to get from 7 to =
the 1-4-2 loop

----------------------------------------
Bug #9683: Segmentation fault when using default proc feature in ruby Hash =
object
https://bugs.ruby-lang.org/issues/9683#change-46038

* Author: Eran Barak Levi
* Status: Open
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------

=E2=9E=9C  bruno-v2 rvm:(ruby-2.1.0) git:(master) =E2=9C=97 uname -a
Darwin erans-mbp.intkontera.com 13.1.0 Darwin Kernel Version 13.1.0: Thu Ja=
n 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
=E2=9E=9C  bruno-v2 rvm:(ruby-2.1.0) git:(master) =E2=9C=97 rvm -v
rvm 1.25.19 (stable) by Wayne E. Seguin <[email protected]>, Michal Pa=
pis <[email protected]> [https://rvm.io/]
=E2=9E=9C  bruno-v2 rvm:(ruby-2.1.0) git:(master) =E2=9C=97 ruby -v=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
=E2=9E=9C  bruno-v2 rvm:(ruby-2.1.0) git:(master) =E2=9C=97 ruby -e "a =3D =
Hash.new {|h,k| h[k] +=3D 1};a[1]" 2> output=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
[1]    24934 segmentation fault  ruby -e "a =3D Hash.new {|h,k| h[k] +=3D 1=
};a[1]" 2> output

more information in the attached files

---Files--------------------------------
ruby_2014-03-27-153720_Erans-MacBook-Pro.crash (45.3 KB)
output (489 KB)
9683.patch (1.31 KB)


--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next