format_parser 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6402f116eddca928e4807f76d4631f052a841c360137833310900b9604107997
4
- data.tar.gz: 62e2a34f739d912f850e1e732c3e9cc154eadcaff5c76cc0f56fc163298e9192
3
+ metadata.gz: 5a9a94233949cc72d18b433cf1ddcba0e479e8b93aa1ff2e48bda6f6d86f667b
4
+ data.tar.gz: 4e357bc46207e95cad52d21b2aaa1781e9c231bab02e235be29663db9722f5d9
5
5
  SHA512:
6
- metadata.gz: 9385682da9e3a86f67e25cf3491c90f8993a4073a9378f33d20e470f5917dea9afe913c29c16f17412e5f46fb226b8016c51a18327eee74b5f624e304d227c83
7
- data.tar.gz: 2aa680436faa13496921e6134b3b3c341bd0e0b21c1a2a8656e3102165bb6f5bdec941790797861720f840283a171dc9501ae572f4048c8fbe76393badb8bdea
6
+ metadata.gz: dcf8c8aeefc6166f3645dae461aadbcc2b36e96cb7a75162586fc009d562f6f978767ff877b27d0c192b5ca3107011a1bfdda842e730e486ced02e4191b53f59
7
+ data.tar.gz: fbc2caafb269f5e9c249e6ffe62ea8141477589256fab1bea5d058877d571725b1e619619ef9fcd33005d42759697ae7c7575d7a79217bdedc7e96ab02ce3c1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.4.2
2
+ * Fix `MP3Parser` taking precedence when parsing `WEBP` files.
3
+
1
4
  ## 1.4.1
2
5
  * Skip Exif chunks that are malformed during `WEBP` parsing.
3
6
 
@@ -1,3 +1,3 @@
1
1
  module FormatParser
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
@@ -28,6 +28,7 @@ class FormatParser::MP3Parser
28
28
  # For some edge cases
29
29
  ZIP_LOCAL_ENTRY_SIGNATURE = "PK\x03\x04\x14\x00".b
30
30
  PNG_HEADER_BYTES = [137, 80, 78, 71, 13, 10, 26, 10].pack('C*')
31
+ WEBP_HEADER_REGEX = /RIFF.{4}WEBP/i
31
32
 
32
33
  MAGIC_LE = [0x49, 0x49, 0x2A, 0x0].pack('C4')
33
34
  MAGIC_BE = [0x4D, 0x4D, 0x0, 0x2A].pack('C4')
@@ -68,9 +69,10 @@ class FormatParser::MP3Parser
68
69
  # will terminate here. Same with PNGs. In the future
69
70
  # we should implement "confidence" for MP3 as of all our formats
70
71
  # it is by far the most lax.
71
- header = safe_read(io, 8)
72
+ header = safe_read(io, 12)
72
73
  return if header.start_with?(ZIP_LOCAL_ENTRY_SIGNATURE)
73
74
  return if header.start_with?(PNG_HEADER_BYTES)
75
+ return if header.start_with?(WEBP_HEADER_REGEX)
74
76
 
75
77
  io.seek(0)
76
78
  return if TIFF_HEADER_BYTES.include?(safe_read(io, 4))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: format_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Berman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-07-12 00:00:00.000000000 Z
12
+ date: 2022-07-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ks
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
321
  requirements: []
322
- rubygems_version: 3.2.33
322
+ rubygems_version: 3.3.7
323
323
  signing_key:
324
324
  specification_version: 4
325
325
  summary: A library for efficient parsing of file metadata