diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 10:11:49 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-27 10:11:49 +0000 |
commit | 88c68a89d3bfae15664f59355c013c0c23bd1a63 (patch) | |
tree | df2356b784fe1b7cfd7466f871e9faa1f639ba9a /test | |
parent | a078bbcc172dae52bfd8bf9d25f7736a544972e8 (diff) |
merge revision(s) 56894: [Backport #12974]
marshal.c: fix infinite recursion
* marshal.c (check_userdump_arg): marshal_dump should not return
an instance of the same class, otherwise it causes infinite
recursion. [ruby-core:78289] [Bug #12974]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@57211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_marshal.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index ef987cc7fa..1dc9850d25 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -671,4 +671,16 @@ class TestMarshal < Test::Unit::TestCase end RUBY end + + class Bug12974 + def marshal_dump + dup + end + end + + def test_marshal_dump_recursion + assert_raise_with_message(RuntimeError, /same class instance/) do + Marshal.dump(Bug12974.new) + end + end end |