diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-12-19 14:10:58 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-12-20 14:12:38 +0900 |
commit | 2e7e153a2af1456515d43b6381e38534b069b1c2 (patch) | |
tree | a7c1730d6b86170e9e80f2e9705ea824ed517829 /test/ruby/test_exception.rb | |
parent | 18ba89093a0b214cd89f1567c037c239f094496d (diff) |
[Bug #19242] Prohibit circular causes to be loaded
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6960
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 9bed2c76cd..c2eada0bfb 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1412,6 +1412,18 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end; end + def test_marshal_circular_cause + begin + raise RuntimeError, "err", [], cause: Exception.new + rescue => e + end + dump = Marshal.dump(e).sub(/o:\x0EException\x08;.0;.0;.0/, "@\x05") + assert_raise_with_message(ArgumentError, /circular cause/, ->{dump.inspect}) do + e = Marshal.load(dump) + assert_same(e, e.cause) + end + end + def test_super_in_method_missing assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") begin; |