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:
Gerhard Schlager 2020-01-09 15:11:31 +01:00
parent 8b3c40c79d
commit 2a06f67099
1 changed files with 1 additions and 2 deletions

View File

@ -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