aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-03-11 08:26:52 -0800
committerXavier Noria <fxn@hashref.com>2016-03-11 08:26:52 -0800
commite56b594d323e9c17398e65caa0fad20500868135 (patch)
treea017cc53ec9cb63f8d956b5deeed7b15a41fcce6 /activesupport/test
parent120517706e778035ecb9920a8538a00578e79a63 (diff)
parentaa0fad51482c24ece58ec7186c45fd340b35ecb1 (diff)
downloadrails-e56b594d323e9c17398e65caa0fad20500868135.tar.gz
rails-e56b594d323e9c17398e65caa0fad20500868135.tar.bz2
rails-e56b594d323e9c17398e65caa0fad20500868135.zip
Merge pull request #24150 from exviva/unmarshal-infinite-retry
Prevent `Marshal.load` from looping infinitely
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/marshal_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb
index 5427837d19..07c0c0d8cb 100644
--- a/activesupport/test/core_ext/marshal_test.rb
+++ b/activesupport/test/core_ext/marshal_test.rb
@@ -64,6 +64,17 @@ class MarshalTest < ActiveSupport::TestCase
end
end
+ test "when one constant resolves to another" do
+ class Parent; C = Class.new; end
+ class Child < Parent; C = Class.new; end
+
+ dump = Marshal.dump(Child::C.new)
+
+ Child.send(:remove_const, :C)
+
+ assert_raise(ArgumentError) { Marshal.load(dump) }
+ end
+
test "that a real missing class is causing an exception" do
dumped = nil
with_autoloading_fixtures do