rubyzip 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubyzip might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 898367588fc593bddd565ee8626c75cfbcddfce2
4
- data.tar.gz: 24d90fd344a11d8cf3b8098c459eb2c765e933e7
2
+ SHA256:
3
+ metadata.gz: 5bed33b4d4b864f1ad4d1a3483022c13b8079a607b2e4afc5b3828b9267f04c8
4
+ data.tar.gz: 0acb47d50691a266b1abc45e9b9c2abe5ac2310f38706ef5905bf53723e1f26d
5
5
  SHA512:
6
- metadata.gz: 4f00c8c74720ba3bf103596601400f57e89d03cdd90b4423debd4c96ed6150a3db0fa8f7407201657cf6a7ee0b2e6586c7a284e1398dd1cf44c523799e1b25be
7
- data.tar.gz: 3a434114b84d7b109e26aec4821b395ad100efda591ad004656c6b5fd8cdba3740e50c171409c726a9770996e0815ef0324c87063d975024642c6f89ba56377e
6
+ metadata.gz: 64da2a44d5a0b167ad81023554552f7cf101a6e5eb380ef356abaeb3c97d40e6dc6a5013b3fbfa615823833106bb31c8766e38b81d378b685a4eb680f5cc4ab5
7
+ data.tar.gz: 7f8157731ecfbb4497e97dcaff38bb6f259c5b18f070e04d5706170a999c7e0d41a32487fbf0e297836f60669f6d0a3e0cbbead7f5c2a06b56f651285786163e
@@ -1,3 +1,4 @@
1
+ require 'pathname'
1
2
  module Zip
2
3
  class Entry
3
4
  STORED = 0
@@ -117,7 +118,7 @@ module Zip
117
118
  return false unless cleanpath.relative?
118
119
  root = ::File::SEPARATOR
119
120
  naive_expanded_path = ::File.join(root, cleanpath.to_s)
120
- cleanpath.expand_path(root).to_s == naive_expanded_path
121
+ ::File.absolute_path(cleanpath.to_s, root) == naive_expanded_path
121
122
  end
122
123
 
123
124
  def local_entry_offset #:nodoc:all
@@ -275,10 +276,10 @@ module Zip
275
276
  zip64 = @extra['Zip64']
276
277
  [::Zip::LOCAL_ENTRY_SIGNATURE,
277
278
  @version_needed_to_extract, # version needed to extract
278
- @gp_flags, # @gp_flags ,
279
+ @gp_flags, # @gp_flags
279
280
  @compression_method,
280
- @time.to_binary_dos_time, # @last_mod_time ,
281
- @time.to_binary_dos_date, # @last_mod_date ,
281
+ @time.to_binary_dos_time, # @last_mod_time
282
+ @time.to_binary_dos_date, # @last_mod_date
282
283
  @crc,
283
284
  zip64 && zip64.compressed_size ? 0xFFFFFFFF : @compressed_size,
284
285
  zip64 && zip64.original_size ? 0xFFFFFFFF : @size,
@@ -432,11 +433,11 @@ module Zip
432
433
  @header_signature,
433
434
  @version, # version of encoding software
434
435
  @fstype, # filesystem type
435
- @version_needed_to_extract, # @versionNeededToExtract ,
436
- @gp_flags, # @gp_flags ,
436
+ @version_needed_to_extract, # @versionNeededToExtract
437
+ @gp_flags, # @gp_flags
437
438
  @compression_method,
438
- @time.to_binary_dos_time, # @last_mod_time ,
439
- @time.to_binary_dos_date, # @last_mod_date ,
439
+ @time.to_binary_dos_time, # @last_mod_time
440
+ @time.to_binary_dos_date, # @last_mod_date
440
441
  @crc,
441
442
  zip64 && zip64.compressed_size ? 0xFFFFFFFF : @compressed_size,
442
443
  zip64 && zip64.original_size ? 0xFFFFFFFF : @size,
@@ -602,7 +603,7 @@ module Zip
602
603
  get_input_stream do |is|
603
604
  set_extra_attributes_on_path(dest_path)
604
605
 
605
- buf = ''
606
+ buf = ''.dup
606
607
  while (buf = is.sysread(::Zip::Decompressor::CHUNK_SIZE, buf))
607
608
  os << buf
608
609
  end
@@ -26,7 +26,7 @@ module Zip
26
26
  end
27
27
 
28
28
  def create_unknown_item
29
- s = ''
29
+ s = ''.dup
30
30
  class << s
31
31
  alias_method :to_c_dir_bin, :to_s
32
32
  alias_method :to_local_bin, :to_s
@@ -3,7 +3,7 @@ module Zip
3
3
  def initialize(input_stream, decrypter = NullDecrypter.new)
4
4
  super(input_stream)
5
5
  @zlib_inflater = ::Zlib::Inflate.new(-Zlib::MAX_WBITS)
6
- @output_buffer = ''
6
+ @output_buffer = ''.dup
7
7
  @has_returned_empty_string = false
8
8
  @decrypter = decrypter
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module Zip
2
- VERSION = '1.2.2'
2
+ VERSION = '1.2.3'
3
3
  end
@@ -131,4 +131,11 @@ class PathTraversalTest < MiniTest::Test
131
131
  refute File.exist?('/tmp/file.txt')
132
132
  end
133
133
  end
134
+
135
+ def test_entry_name_with_tilde
136
+ in_tmpdir do
137
+ extract_path_traversal_zip 'tilde.zip'
138
+ assert File.exist?('~tilde~')
139
+ end
140
+ end
134
141
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Simonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -164,6 +164,7 @@ files:
164
164
  - test/data/path_traversal/jwilk/relative2.zip
165
165
  - test/data/path_traversal/jwilk/symlink.zip
166
166
  - test/data/path_traversal/relative1.zip
167
+ - test/data/path_traversal/tilde.zip
167
168
  - test/data/path_traversal/tuzovakaoff/README.md
168
169
  - test/data/path_traversal/tuzovakaoff/absolutepath.zip
169
170
  - test/data/path_traversal/tuzovakaoff/symlink.zip
@@ -226,8 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  - !ruby/object:Gem::Version
227
228
  version: '0'
228
229
  requirements: []
229
- rubyforge_project:
230
- rubygems_version: 2.6.13
230
+ rubygems_version: 3.0.1
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: rubyzip is a ruby module for reading and writing zip files
@@ -280,6 +280,7 @@ test_files:
280
280
  - test/data/rubycode2.zip
281
281
  - test/data/mimetype
282
282
  - test/data/zipWithEncryption.zip
283
+ - test/data/path_traversal/tilde.zip
283
284
  - test/data/path_traversal/Makefile
284
285
  - test/data/path_traversal/relative1.zip
285
286
  - test/data/path_traversal/jwilk/dirsymlink.zip