Project

General

Profile

Actions

Bug #9151

closed

Segfault in Ruby head

Added by sam.saffron (Sam Saffron) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby-head
[ruby-core:58567]

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

Updated by nobu (Nobuyoshi Nakada) about 11 years ago

It's a simple machine stack overflow.
What's your platform?

Updated by Hanmac (Hans Mackowiak) about 11 years ago

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]

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 11 years ago

  • 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0