Bug #9151
closed
Added by sam.saffron (Sam Saffron) almost 11 years ago.
Updated almost 11 years ago.
Description
Following code causes a segfault in ruby head on x64:
class A
attr_accessor :b
def hash
[b,""].hash
end
end
class B
attr_accessor :a
def hash
[a,""].hash
end
end
a = A.new
b = B.new
a.b = b
b.a = a
p a.hash
p b.hash
p [a,"hello"].hash == [b,"world"].hash
It's a simple machine stack overflow.
What's your platform?
its a similar error to #9003
p a.hash # raises Stack Error
p b.hash # Segmentation fault: 11
happens for:
ruby 2.1.0dev (2013-11-26 trunk 43854) [x86_64-darwin12.0]
does not happen for:
ruby 2.1.0dev (2013-09-22 trunk 43011) [i686-linux]
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r43859.
Sam, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
hash.c: cut off if recursion
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0