diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-29 07:44:18 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-29 07:44:18 +0000 |
| commit | 46e7e1f9ffe5428871319718024b4707bc5ce27d (patch) | |
| tree | b427115be581ab524ff0b02df3e35e38c092b561 /test/ruby | |
| parent | 2f29baf68cd1cd77f91ae83a0015878f9b1cbd31 (diff) | |
merge revision(s) 54105,54108,54136,54138: [Backport #12188]
* marshal.c (r_object0): Fix Marshal crash for corrupt extended object.
* marshal.c (r_object0): raise ArgumentError when linking to undefined
object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_marshal.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 8377de2155..e2e321bb41 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -718,4 +718,22 @@ class TestMarshal < Test::Unit::TestCase obj = [str, str] assert_equal(['X', 'X'], Marshal.load(Marshal.dump(obj), ->(v) { v == str ? v.upcase : v })) end + + def test_marshal_load_extended_class_crash + crash = "\x04\be:\x0F\x00omparableo:\vObject\x00" + + opt = %w[--disable=gems] + assert_ruby_status(opt, "Marshal.load(#{crash.dump})") + end + + def test_marshal_load_r_prepare_reference_crash + crash = "\x04\bI/\x05\x00\x06:\x06E{\x06@\x05T" + + opt = %w[--disable=gems] + assert_separately(opt, <<-RUBY) + assert_raise_with_message(ArgumentError, /bad link/) do + Marshal.load(#{crash.dump}) + end + RUBY + end end |
