fastimage 2.4.2 → 2.4.3

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: 67d8bb4b8d87e073cb5251387d5f73846849126eac20202cf964d5159afab120
4
- data.tar.gz: 9e43de443fcaef8c4a99e76568a52adb74e06f6e59f361c0974bbebc56de6bcc
3
+ metadata.gz: ccdbb1bae657d9c0e935422f1194986c5b78bcc23cdf3fcba4bd741f764a3d28
4
+ data.tar.gz: 88e8d78e8958a33d36fa887a01cb55083ca424919fceaf252760e81148022c44
5
5
  SHA512:
6
- metadata.gz: c219a4b5df6301e3ce50e7731dd9cf0bca79a591635e31515f7535a5d9fc0386d69c0fa47a26bd25ea9dc0ff5ed960b66da3d99f28cd89acacf5640b65f2aadb
7
- data.tar.gz: ba453f683cf2e68c9d7c9a4b741b0e77f2c6bd8f84fdb10685aba031c6114e008c94d3dbb4c08b883f72f5447fa9305cce558e4e12912f4d97eb2318b8438155
6
+ metadata.gz: 839a15a2876f6855bbe4a7efdce3d1243dcc591c6962623f809a98582e753e085ce0bb409be726ede08f0cdfd6f438add649fdaddd20ac509dcdd6dd60b992a4
7
+ data.tar.gz: 0efd8b69909220e73f8f5683c8275af8040f1e61f5a2687cf097face9fa5ce14d6d5a3d46c10cceed96b2200cc98ecc4f363f5ca2a15a5f1cb16fa3344b9bd7c
@@ -13,8 +13,11 @@ module FastImageParsing
13
13
  @str = ''
14
14
  end
15
15
 
16
- # Peeking beyond the end of the input will raise
16
+ # Peeking beyond the end of the input will raise. A negative length would
17
+ # move the cursor backwards, so treat it as unparseable data.
17
18
  def peek(n)
19
+ raise FastImage::CannotParseImage if n < 0
20
+
18
21
  while @strpos + n > @str.size
19
22
  unused_str = @str[@strpos..-1]
20
23
 
@@ -38,6 +41,8 @@ module FastImageParsing
38
41
  end
39
42
 
40
43
  def skip(n)
44
+ raise FastImage::CannotParseImage if n < 0
45
+
41
46
  discarded = 0
42
47
  fetched = @str[@strpos..-1].size
43
48
  while n > fetched
@@ -6,6 +6,7 @@ module FastImageParsing
6
6
  [jxlc.width, jxlc.height]
7
7
  else
8
8
  bmff = IsoBmff.new(@stream)
9
+ return nil unless bmff.width && bmff.height
9
10
  [bmff.width, bmff.height]
10
11
  end
11
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FastImage
4
- VERSION = '2.4.2'
4
+ VERSION = '2.4.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes