File CVE-2022-23633.patch of Package rubygem-activesupport-5_1.26200
--- activesupport-5.1.4/lib/active_support/execution_wrapper.rb
+++ activesupport-5.1.4/lib/active_support/execution_wrapper.rb
@@ -62,18 +62,21 @@ def self.register_hook(hook, outer: false)
# after the work has been performed.
#
# Where possible, prefer +wrap+.
- def self.run!
- if active?
- Null
+ def self.run!(reset: false)
+ if reset
+ lost_instance = active.delete(Thread.current)
+ lost_instance&.complete!
else
- new.tap do |instance|
- success = nil
- begin
- instance.run!
- success = true
- ensure
- instance.complete! unless success
- end
+ return Null if active?
+ end
+
+ new.tap do |instance|
+ success = nil
+ begin
+ instance.run!
+ success = true
+ ensure
+ instance.complete! unless success
end
end
end
@@ -102,11 +105,11 @@ def self.inherited(other) # :nodoc:
self.active = Concurrent::Hash.new
def self.active? # :nodoc:
- @active[Thread.current]
+ @active.key?(Thread.current)
end
def run! # :nodoc:
- self.class.active[Thread.current] = true
+ self.class.active[Thread.current] = self
run_callbacks(:run)
end
--- activesupport-5.1.4/lib/active_support/reloader.rb
+++ activesupport-5.1.4/lib/active_support/reloader.rb
@@ -59,7 +59,7 @@ def self.reload!
prepare!
end
- def self.run! # :nodoc:
+ def self.run!(reset: false) # :nodoc:
if check!
super
else
--
2.35.0