rubyzip 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 169fa7d5832e775e15c2f8a409a35e9da32c0177117039f089f9fa1646aa281e
4
- data.tar.gz: 9b4fb8929262cb097e3631ad8d8a9efa98d691488ce79e37092df4de27204aea
3
+ metadata.gz: 67852d915e2ec168efb617d7577ac60196bf7433b3c2800981a14c5a43b939c5
4
+ data.tar.gz: '039b39e7e9e7f46e056da4d0070554eba081e26a4dd99e3dd47d76428628d29f'
5
5
  SHA512:
6
- metadata.gz: 4bc8630670298d013486cf4632084554a10ed2ba327c2b54f65c105602f31ca84b87a42976fa1a606226d7cc5b88ecbc356f8a0932a9a53880e0b68c4b7f6275
7
- data.tar.gz: 4cc717180899d18767c73913fa16abaafeb3624167fc2c4e14a43dde406eef815d9791e84a7bb9f018a255e32d08109dc01efdd8844cc1503a85ac8d931d4b22
6
+ metadata.gz: ba24363c26265acbd295289685d5baa4d351a913d98de67064171c35f0055f04ac34b2e6db384af248e124b12abc505bac558205eadb2975d3d4da59178b9a54
7
+ data.tar.gz: b654167d21076c70ea58b6a185f4be83a6ef172d208bf4f8a8928ac82aa909773b20df462870dc833b1182f669334e18fd7283e23cf4040b770faea1a49d1e6a
data/Changelog.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 3.2.2 (2025-11-02)
2
+
3
+ - Fix reading EOCDs when header signatures are in an Entry payload. [#656](https://github.com/rubyzip/rubyzip/issues/656)
4
+
5
+ Tooling/internal:
6
+
7
+ - Stop using macos-13 runners in GitHub Actions.
8
+ - Update YJIT GitHub Actions runners.
9
+
10
+ # 3.2.1 (2025-10-24)
11
+
12
+ - Fix `Entry#gather_fileinfo_from_srcpath` error messages. [#654](https://github.com/rubyzip/rubyzip/issues/654)
13
+
14
+ Tooling/internal:
15
+
16
+ - Add some simple benchmarks for reading the cdir.
17
+
1
18
  # 3.2.0 (2025-10-14)
2
19
 
3
20
  - Add option to suppress extra fields. [#653](https://github.com/rubyzip/rubyzip/pull/653) (fixes [#34](https://github.com/rubyzip/rubyzip/issues/34), [#398](https://github.com/rubyzip/rubyzip/issues/398) and [#648](https://github.com/rubyzip/rubyzip/issues/648))
@@ -143,28 +143,27 @@ module Zip
143
143
  zip64_eocd_offset
144
144
  end
145
145
 
146
- def unpack_e_o_c_d(buffer) # :nodoc:
146
+ # Unpack the EOCD and return a boolean indicating whether this header is
147
+ # complete without needing Zip64 extensions.
148
+ def unpack_e_o_c_d(buffer) # :nodoc: # rubocop:disable Naming/PredicateMethod
147
149
  _, # END_OF_CD_SIG. We know we have this at this point.
148
- num_disk,
149
- num_disk_cdir,
150
- num_cdir_disk,
151
- num_entries,
152
- size_in_bytes,
153
- cdir_offset,
150
+ @number_of_this_disk,
151
+ @number_of_disk_with_start_of_cdir,
152
+ @total_number_of_entries_in_cdir_on_this_disk,
153
+ @size,
154
+ @size_in_bytes,
155
+ @cdir_offset,
154
156
  comment_length = buffer.unpack('VvvvvVVv')
155
157
 
156
- @number_of_this_disk = num_disk unless num_disk == 0xFFFF
157
- @number_of_disk_with_start_of_cdir = num_disk_cdir unless num_disk_cdir == 0xFFFF
158
- @total_number_of_entries_in_cdir_on_this_disk = num_cdir_disk unless num_cdir_disk == 0xFFFF
159
- @size = num_entries unless num_entries == 0xFFFF
160
- @size_in_bytes = size_in_bytes unless size_in_bytes == 0xFFFFFFFF
161
- @cdir_offset = cdir_offset unless cdir_offset == 0xFFFFFFFF
162
-
163
158
  @comment = if comment_length.positive?
164
159
  buffer.slice(STATIC_EOCD_SIZE, comment_length)
165
160
  else
166
161
  ''
167
162
  end
163
+
164
+ !([@number_of_this_disk, @number_of_disk_with_start_of_cdir,
165
+ @total_number_of_entries_in_cdir_on_this_disk, @size].any?(0xFFFF) ||
166
+ @size_in_bytes == 0xFFFFFFFF || @cdir_offset == 0xFFFFFFFF)
168
167
  end
169
168
 
170
169
  def read_central_directory_entries(io) # :nodoc:
@@ -217,30 +216,37 @@ module Zip
217
216
  eocd_location = data.rindex([END_OF_CD_SIG].pack('V'))
218
217
  raise Error, 'Zip end of central directory signature not found' unless eocd_location
219
218
 
220
- zip64_eocd_locator = data.rindex([ZIP64_EOCD_LOCATOR_SIG].pack('V'))
221
-
222
- if zip64_eocd_locator
223
- zip64_eocd_location = data.rindex([ZIP64_END_OF_CD_SIG].pack('V'))
219
+ # Parse the EOCD and return if it is complete without Zip64 extensions.
220
+ return if unpack_e_o_c_d(data.slice(eocd_location..-1))
224
221
 
225
- zip64_eocd_data =
226
- if zip64_eocd_location
227
- data.slice(zip64_eocd_location..zip64_eocd_locator)
228
- else
229
- zip64_eocd_location = unpack_64_eocd_locator(
230
- data.slice(zip64_eocd_locator..eocd_location)
231
- )
232
- unless zip64_eocd_location
233
- raise Error, 'Zip64 end of central directory signature not found'
234
- end
222
+ # Need to read in the Zip64 EOCD locator and then the Zip64 EOCD.
223
+ zip64_eocd_locator = data.rindex([ZIP64_EOCD_LOCATOR_SIG].pack('V'), eocd_location)
224
+ unless zip64_eocd_locator
225
+ raise Error, 'Zip64 end of central directory locator signature expected but not found'
226
+ end
235
227
 
236
- io.seek(zip64_eocd_location, IO::SEEK_SET)
237
- io.read(base_location + zip64_eocd_locator - zip64_eocd_location)
228
+ # Do we already have the Zip64 EOCD in the data we've read?
229
+ zip64_eocd_location = data.rindex([ZIP64_END_OF_CD_SIG].pack('V'), zip64_eocd_locator)
230
+
231
+ zip64_eocd_data =
232
+ if zip64_eocd_location
233
+ # Yes.
234
+ data.slice(zip64_eocd_location..zip64_eocd_locator)
235
+ else
236
+ # No. Read its location from the locator and then read it in.
237
+ zip64_eocd_location = unpack_64_eocd_locator(
238
+ data.slice(zip64_eocd_locator..eocd_location)
239
+ )
240
+ unless zip64_eocd_location
241
+ raise Error, 'Zip64 end of central directory signature not found'
238
242
  end
239
243
 
240
- unpack_64_e_o_c_d(zip64_eocd_data)
241
- end
244
+ io.seek(zip64_eocd_location, IO::SEEK_SET)
245
+ io.read(base_location + zip64_eocd_locator - zip64_eocd_location)
246
+ end
242
247
 
243
- unpack_e_o_c_d(data.slice(eocd_location..-1))
248
+ # Finally, unpack the Zip64 EOCD.
249
+ unpack_64_e_o_c_d(zip64_eocd_data)
244
250
  end
245
251
 
246
252
  def eocd_data(io)
data/lib/zip/entry.rb CHANGED
@@ -677,7 +677,7 @@ module Zip
677
677
  when 'file'
678
678
  if name_is_directory?
679
679
  raise ArgumentError,
680
- "entry name '#{newEntry}' indicates directory entry, but " \
680
+ "entry name '#{@name}' indicates a directory entry, but " \
681
681
  "'#{src_path}' is not a directory"
682
682
  end
683
683
  :file
@@ -687,7 +687,7 @@ module Zip
687
687
  when 'link'
688
688
  if name_is_directory?
689
689
  raise ArgumentError,
690
- "entry name '#{newEntry}' indicates directory entry, but " \
690
+ "entry name '#{@name}' indicates a directory entry, but " \
691
691
  "'#{src_path}' is not a directory"
692
692
  end
693
693
  :symlink
data/lib/zip/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zip
4
4
  # The version of the Rubyzip library.
5
- VERSION = '3.2.0'
5
+ VERSION = '3.2.2'
6
6
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
8
  - John Lees-Miller
9
9
  - Alexander Simonov
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2025-10-14 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: minitest
@@ -124,7 +123,6 @@ dependencies:
124
123
  - - "~>"
125
124
  - !ruby/object:Gem::Version
126
125
  version: '0.8'
127
- description:
128
126
  email:
129
127
  - hainesr@gmail.com
130
128
  - jdleesmiller@gmail.com
@@ -197,12 +195,11 @@ licenses:
197
195
  - BSD-2-Clause
198
196
  metadata:
199
197
  bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
200
- changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.2.0/Changelog.md
201
- documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.2.0
202
- source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.2.0
198
+ changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.2.2/Changelog.md
199
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.2.2
200
+ source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.2.2
203
201
  wiki_uri: https://github.com/rubyzip/rubyzip/wiki
204
202
  rubygems_mfa_required: 'true'
205
- post_install_message:
206
203
  rdoc_options: []
207
204
  require_paths:
208
205
  - lib
@@ -217,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
214
  - !ruby/object:Gem::Version
218
215
  version: '0'
219
216
  requirements: []
220
- rubygems_version: 3.4.19
221
- signing_key:
217
+ rubygems_version: 3.7.2
222
218
  specification_version: 4
223
219
  summary: rubyzip is a ruby module for reading and writing zip files
224
220
  test_files: []