aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/gzip.rb
diff options
context:
space:
mode:
authorDylan Thacker-Smith <Dylan.Smith@shopify.com>2017-02-24 17:26:54 -0500
committerDylan Thacker-Smith <Dylan.Smith@shopify.com>2017-02-24 17:33:36 -0500
commit29c02709cd68a122c5db4f58ec0e901fe3d507cc (patch)
treee989ba88823b4011a35ff11687c05eecd18b638d /activesupport/lib/active_support/gzip.rb
parent87b2b6c5124732ff709b8e1900a99ba0a08f6982 (diff)
downloadrails-29c02709cd68a122c5db4f58ec0e901fe3d507cc.tar.gz
rails-29c02709cd68a122c5db4f58ec0e901fe3d507cc.tar.bz2
rails-29c02709cd68a122c5db4f58ec0e901fe3d507cc.zip
Add missing gzip footer check in ActiveSupport::Gzip.decompress
A gzip file has a checksum and length for the decompressed data in its footer which isn't checked by just calling Zlib::GzipReader#read. Calling Zlib::GzipReader#close must be called after reading to the end of the file causes this check to be done, which is done by Zlib::GzipReader.wrap after its block is called.
Diffstat (limited to 'activesupport/lib/active_support/gzip.rb')
-rw-r--r--activesupport/lib/active_support/gzip.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/gzip.rb b/activesupport/lib/active_support/gzip.rb
index 84eef6a623..95a86889ec 100644
--- a/activesupport/lib/active_support/gzip.rb
+++ b/activesupport/lib/active_support/gzip.rb
@@ -21,7 +21,7 @@ module ActiveSupport
# Decompresses a gzipped string.
def self.decompress(source)
- Zlib::GzipReader.new(StringIO.new(source)).read
+ Zlib::GzipReader.wrap(StringIO.new(source), &:read)
end
# Compresses a string using gzip.