mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
722c45f641
Exclude missing marshal_dump and _dump methods from being delegated to an object's delegation target via the delegate_missing_to extension. This avoids unintentionally adding instance variables to an object during marshallization, should the delegation target be a method which would otherwise add them. In current versions of Ruby, a bug exists in the way objects are marshalled, allowing for instance variables to be added or removed during marshallization (see https://bugs.ruby-lang.org/issues/15968). This results in a corrupted serialized byte stream, causing an object's instance variables to "leak" into subsequent serialized objects during demarshallization. In Rails, this behavior may be triggered when marshalling an object that uses the delegate_missing_to extension, if the delegation target is a method which adds or removes instance variables to an object being marshalled - when calling Marshal.dump(object), Ruby's built in behavior will check whether the object responds to :marshal_dump or :_dump, which in turn triggers the delegation target method in the responds_to_missing? function defined in activesupport/lib/active_support/core_ext/module/delegation.rb While future versions of Ruby will resolve this bug by raising a RuntimeError, the underlying cause of this error may not be readily apparent when encountered by Rails developers. By excluding marshal_dump and _dump from being delegated to an object's target, this commit eliminates a potential cause of unexpected behavior and/or RuntimeErrors. Fixes #36522 |
||
---|---|---|
.. | ||
array | ||
class | ||
digest | ||
hash | ||
kernel | ||
module | ||
object | ||
bigdecimal_test.rb | ||
class_test.rb | ||
date_and_time_behavior.rb | ||
date_and_time_compatibility_test.rb | ||
date_ext_test.rb | ||
date_time_ext_test.rb | ||
duration_test.rb | ||
enumerable_test.rb | ||
file_test.rb | ||
hash_ext_test.rb | ||
integer_ext_test.rb | ||
kernel_test.rb | ||
load_error_test.rb | ||
marshal_test.rb | ||
module_test.rb | ||
name_error_test.rb | ||
numeric_ext_test.rb | ||
range_ext_test.rb | ||
regexp_ext_test.rb | ||
secure_random_test.rb | ||
string_ext_test.rb | ||
time_ext_test.rb | ||
time_with_zone_test.rb | ||
uri_ext_test.rb |