Backport #2557
closedSegmentation fault in Marshal.load in Rails' ActiveSupport in 1.8.7-p248 only
Description
=begin
There is a consistent segmentation fault in a particular invocation of Marshal.load inside of ActiveSupport. This segfault happens on 1.8.7-p248 and not on 1.8.7-p174. Apologies, but I have not been able to come up with a simpler reproduction. Here's how you can reproduce it from activesupport:
$ git clone git://github.com/rails/rails.git
[...]
$ cd rails/activesupport
Create a file called @fault.rb@ (or whatever you would like) with the following contents:
fault.rb¶
require File.expand_path("../lib/active_support/multibyte/unicode_database.rb", FILE)
ActiveSupport::Multibyte::UnicodeDatabase.new.codepoints
puts "No crash"
Then execute it:
$ ruby -v
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0]
$ ruby fault.rb
/private/tmp/rails/activesupport/lib/active_support/multibyte/unicode_database.rb:37: [BUG] Segmentation fault
ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin9.8.0]
Abort trap
But in 1.8.7-p174:
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0]
$ ruby fault.rb
No crash
This may be related to #2175. Unfortunately, I can't read Japanese so I'm not sure. The backtrace from gdb for this crash does not match the one in #2175, but a colleague pointed out that including @GC.disable@ in @fault.rb@ prevents the crash.
=end