Project

General

Profile

Actions

Bug #10164

closed

Reproducable segfault for 2.1

Added by gsamokovarov (Genadi Samokovarov) about 10 years ago. Updated about 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.1
[ruby-core:64510]

Description

Hi,

I have a snippet of code that crashes Ruby 2.1.{1,2} every time for me.

class Exception
  def set_backtrace_with_extension
    set_backtrace_without_extension(*args)
  end
 
  alias set_backtrace_without_extension set_backtrace
  alias set_backtrace set_backtrace_with_extension
end
 
raise

You can also download it at https://gist.github.com/gsamokovarov/2a855de7737b8c2443ec

It gives me the following on OSX with Ruby 2.1.2:

die_ruby.rb:10: [BUG] Segmentation fault at 0x007fff506c5ff8
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.

-- Control frame information -----------------------------------------------
c:0002 p:0015 s:21384 E:0026f8 EVAL   die_ruby.rb:10 [FINISH]
c:0001 p:0000 s:0002 E:001448 TOP    [FINISH]

die_ruby.rb:10:in `<main>'

-- C level backtrace information -------------------------------------------
0   ruby                                0x000000010eec1346 rb_vm_bugreport + 134
1   ruby                                0x000000010ed77843 report_bug + 307
2   ruby                                0x000000010ed77704 rb_bug + 180
3   ruby                                0x000000010ee444d9 sigsegv + 153
4   libsystem_platform.dylib            0x00007fff88af9f1a _sigtramp + 26
5   ruby                                0x000000010ee4b79c ruby__sfvwrite + 12
6   ???                                 0x00007fff506c60b0 0x0 + 140734542667952

-- Other runtime information -----------------------------------------------

* Loaded script: die_ruby.rb

* Loaded features:

    0 enumerator.so
    1 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/enc/encdb.bundle
    2 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/enc/trans/transdb.bundle
    3 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/rbconfig.rb
    4 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/compatibility.rb
    5 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/defaults.rb
    6 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/deprecate.rb
    7 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/errors.rb
    8 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/version.rb
    9 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/requirement.rb
   10 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/platform.rb
   11 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/basic_specification.rb
   12 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/stub_specification.rb
   13 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/util/stringio.rb
   14 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/specification.rb
   15 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/exceptions.rb
   16 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
   17 thread.rb
   18 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/thread.bundle
   19 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb
   20 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb
   21 /Users/genadi/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

fish: Job 1, 'ruby die_ruby.rb' terminated by signal SIGABRT (Abort)

For the Ubuntu precise/Ruby 2.1.1 output, check out this link: https://gist.github.com/gsamokovarov/f2dc3b26857b134c8b21. Its pretty big, so I don't feel like pasting it here will help.

Notice how I don't declare the variadic args in the set_backtrace_with_extension method? The other rubies I tested (1.9.3-448 and 2.0.0-p353) give me:

die_ruby.rb:10: stack level too deep (SystemStackError)
Actions

Also available in: Atom PDF

Like0
Like0Like0