mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FIX: Decompressing lots of small files triggered error
An archive containing lots of small files could trigger an error even though the amount of decompressed data was way below the maximum allowed size. This happened because the decompression algorithm used the chunk size for calculating the remaining size instead of the actual size of the decompressed chunk.
This commit is contained in:
parent
8b3c40c79d
commit
2a06f67099
@ -83,9 +83,8 @@ module Compression
|
||||
end
|
||||
|
||||
::File.open(entry_path, 'wb') do |os|
|
||||
buf = ''.dup
|
||||
while (buf = entry.read(chunk_size))
|
||||
remaining_size -= chunk_size
|
||||
remaining_size -= buf.size
|
||||
raise ExtractFailed if remaining_size.negative?
|
||||
os << buf
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user