format_parser 0.14.0 → 0.14.1

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: 0d9daf0603ac099b75a9ddb85b8061190dc8fe2f3aad46633ff94b1f4a99020e
4
- data.tar.gz: d4343aa08f9ec6a6864a5aed3b7ea174f779c3ea0954417e9b31a2c871126f27
3
+ metadata.gz: 90513000619c11b5a98669f465add204ca68465065681424627adcdf66c634dd
4
+ data.tar.gz: 1515277ec5edc3bedc7631a7a3e5b56975010e1d7a84b5e166b4eae6977eb90a
5
5
  SHA512:
6
- metadata.gz: 2d63a7d9802157e35260b91f5a8077008fa4e7c19837cc4a01ff0d3954fa22d29455a13cb914bc892782d986a7d85b9465eb21b8c753d16c0da774ddb0f5c47c
7
- data.tar.gz: 651d41396efdeb4e9f74173d284617baa0bf34f3ce6e8a6890a1ceadf2ef4a3556a3dd0b4b282dc84ea9f65c020ecbe1ae942da78eed85bed6d969161dbb0cbb
6
+ metadata.gz: ec36c70f585ebc72089be82bba55b21b83d53d59a4233f33be4e78cbde5f7b12bdb99587238a00cfdf023a24daafadc8803d43e88bacd994c97cfe47c3aac4f1
7
+ data.tar.gz: 1e964c45d81b43def5575331f02f0949892ddc06f006c7b83275f72cffafefef25cef6b2b8627db0edb6969a8da1e72fa612f600091630fe0822f842062e75d1
@@ -1,3 +1,7 @@
1
+ ## 0.14.1
2
+ * Care caching: Clear pages more deliberately instead of relegating them to GC
3
+ * JPEG: Clear the EXIF buffer explicitly
4
+
1
5
  ## 0.14.0
2
6
  * PDF: Reduce the PDF parser to the basic binary detection (PDF/not PDF) until we have a better/more robust PDF parser
3
7
  * MP3: Fix the byte length of MPEG frames calculation to correctly account for ID3V1 and ID3V2 instead of ID3V1 twice
@@ -137,6 +137,7 @@ class Care
137
137
  #
138
138
  # @return void
139
139
  def clear
140
+ @pages.map { |maybe_page_str| maybe_page_str.clear if maybe_page_str.respond_to?(:clear) }
140
141
  @pages.clear
141
142
  end
142
143
 
@@ -1,3 +1,3 @@
1
1
  module FormatParser
2
- VERSION = '0.14.0'
2
+ VERSION = '0.14.1'
3
3
  end
@@ -134,12 +134,13 @@ class FormatParser::JPEGParser
134
134
  # seek to the start of the next marker and return
135
135
  return unless maybe_exif_magic_str == EXIF_MAGIC_STRING
136
136
 
137
- # ...and only then read the marker contents and parse it as EXIF
138
- exif_data = safe_read(@buf, app1_frame_content_length - EXIF_MAGIC_STRING.bytesize)
137
+ # ...and only then read the marker contents and parse it as EXIF.
138
+ # Use StringIO.new instead of #write - https://github.com/aws/aws-sdk-ruby/issues/785#issuecomment-95456838
139
+ exif_buf = StringIO.new(safe_read(@buf, app1_frame_content_length - EXIF_MAGIC_STRING.bytesize))
139
140
 
140
- Measurometer.add_distribution_value('format_parser.JPEGParser.bytes_sent_to_exif_parser', exif_data.bytesize)
141
+ Measurometer.add_distribution_value('format_parser.JPEGParser.bytes_sent_to_exif_parser', exif_buf.size)
141
142
 
142
- @exif_data = exif_from_tiff_io(StringIO.new(exif_data))
143
+ @exif_data = exif_from_tiff_io(exif_buf)
143
144
  rescue EXIFR::MalformedTIFF
144
145
  # Not a JPEG or the Exif headers contain invalid data, or
145
146
  # an APP1 marker was detected in a file that is not a JPEG
@@ -147,6 +148,9 @@ class FormatParser::JPEGParser
147
148
  # Reposition the file pointer to where the next marker will begin,
148
149
  # regardless whether we did find usable EXIF or not
149
150
  @buf.seek(marker_length_at + 2 + app1_frame_content_length)
151
+
152
+ # Make sure to explicitly clear the EXIF buffers since they can be large
153
+ exif_buf.truncate(0) if exif_buf
150
154
  end
151
155
 
152
156
  def read_frame
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: 0.14.0
4
+ version: 0.14.1
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: 2018-06-18 00:00:00.000000000 Z
12
+ date: 2018-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ks