fastimage 2.4.1 → 2.4.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: acc5b0541538fa317b5401aa89c2c1f901d73b874d7f99465563ca30ee7cf724
4
- data.tar.gz: 2c78d3222232b442f6f458341db19e9a52c14db32b9c65f10c18e67caeead9a7
3
+ metadata.gz: 67d8bb4b8d87e073cb5251387d5f73846849126eac20202cf964d5159afab120
4
+ data.tar.gz: 9e43de443fcaef8c4a99e76568a52adb74e06f6e59f361c0974bbebc56de6bcc
5
5
  SHA512:
6
- metadata.gz: 2eb212cb3768b60012066aaa9571e016d4ccb9ffec661560dcf7d7d20d39388313ee6b6a8ab66917d5b9334d905688795b9e50d97ff8375c95b82123f50216a3
7
- data.tar.gz: 5967f9290bb98217ea92a0fa2199af9b140ce5ace7b49894dec65f05dda5eaaa115b66c53f0cdcaa0ef5d8984c20c0418dd346515c7e69e186813a71cfaffb59
6
+ metadata.gz: c219a4b5df6301e3ce50e7731dd9cf0bca79a591635e31515f7535a5d9fc0386d69c0fa47a26bd25ea9dc0ff5ed960b66da3d99f28cd89acacf5640b65f2aadb
7
+ data.tar.gz: ba453f683cf2e68c9d7c9a4b741b0e77f2c6bd8f84fdb10685aba031c6114e008c94d3dbb4c08b883f72f5447fa9305cce558e4e12912f4d97eb2318b8438155
@@ -2,6 +2,7 @@ module FastImageParsing
2
2
  class Avif < ImageBase # :nodoc:
3
3
  def dimensions
4
4
  bmff = IsoBmff.new(@stream)
5
+ return nil unless bmff.width && bmff.height
5
6
  [bmff.width, bmff.height]
6
7
  end
7
8
 
@@ -2,6 +2,7 @@ module FastImageParsing
2
2
  class Heic < ImageBase # :nodoc:
3
3
  def dimensions
4
4
  bmff = IsoBmff.new(@stream)
5
+ return nil unless bmff.width && bmff.height
5
6
  [bmff.width, bmff.height]
6
7
  end
7
8
  end
@@ -27,11 +27,11 @@ module FastImageParsing
27
27
  read_boxes!
28
28
  end
29
29
 
30
- if [90, 270].include?(@rotation)
30
+ if @final_size && [90, 270].include?(@rotation)
31
31
  @final_size.reverse!
32
32
  end
33
-
34
- @width, @height = @final_size
33
+
34
+ @width, @height = @final_size if @final_size
35
35
  end
36
36
 
37
37
  private
@@ -153,8 +153,18 @@ module FastImageParsing
153
153
  def read_box_header!
154
154
  size = read_uint32!
155
155
  type = @stream.read(4)
156
- size = read_uint64! - 8 if size == 1
157
- [type, size - 8]
156
+ if size == 1
157
+ size = read_uint64!
158
+ throw :finish if size < 16
159
+ [type, size - 16]
160
+ else
161
+ # size == 0 means the box extends to end of file (ISO/IEC 14496-12 §4.2).
162
+ # size < 8 is malformed (smaller than the header itself). Either way, no
163
+ # further boxes can be parsed at this level, so stop rather than looping
164
+ # on a non-advancing skip.
165
+ throw :finish if size < 8
166
+ [type, size - 8]
167
+ end
158
168
  end
159
169
 
160
170
  def read_uint8!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FastImage
4
- VERSION = '2.4.1'
4
+ VERSION = '2.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-10 00:00:00.000000000 Z
11
+ date: 2026-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakeweb-fi