exifr 0.10.5 → 0.10.6

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ EXIF Reader 0.10.6
2
+ * bug fix (thanks to Forian Munz for reporting it); endless loop when reading a malformed EXIF/TIFF
3
+
1
4
  EXIF Reader 0.10.5
2
5
  * bug fix; "[#15421] duplicate orientation field behavior", first field (of any type) is leading now
3
6
  * Ruby 1.9 compatible
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ end
21
21
 
22
22
  spec = Gem::Specification.new do |s|
23
23
  s.name = 'exifr'
24
- s.version = '0.10.5'
24
+ s.version = '0.10.6'
25
25
  s.author = "R.W. van 't Veer"
26
26
  s.email = 'remco@remvee.net'
27
27
  s.homepage = 'http://exifr.rubyforge.org/'
data/lib/tiff.rb CHANGED
@@ -374,7 +374,7 @@ module EXIFR
374
374
  attr_reader :type, :fields
375
375
 
376
376
  def initialize(data, offset = nil, type = :image)
377
- @data, @type, @fields = data, type, {}
377
+ @data, @offset, @type, @fields = data, offset, type, {}
378
378
 
379
379
  pos = offset || @data.readlong(4)
380
380
  num = @data.readshort(pos)
@@ -413,8 +413,12 @@ module EXIFR
413
413
  to_hash.inspect
414
414
  end
415
415
 
416
+ def next?
417
+ @offset_next != 0 && @offset_next < @data.size && (@offset || 0) < @offset_next
418
+ end
419
+
416
420
  def next
417
- IFD.new(@data, @offset_next) unless @offset_next == 0 || @offset_next >= @data.size
421
+ IFD.new(@data, @offset_next) if next?
418
422
  end
419
423
 
420
424
  def to_yaml_properties
Binary file
data/tests/test_tiff.rb CHANGED
@@ -53,7 +53,7 @@ class TestTIFF < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  def test_dates
56
- (all_test_tiffs - [f('weird_date.exif'), f('plain.tif')]).each do |fname|
56
+ (all_test_tiffs - [f('weird_date.exif'), f('plain.tif'), f('endless-loop.exif')]).each do |fname|
57
57
  assert_kind_of Time, TIFF.new(fname).date_time
58
58
  end
59
59
  assert_nil TIFF.new(f('weird_date.exif')).date_time
@@ -152,4 +152,9 @@ class TestTIFF < Test::Unit::TestCase
152
152
  end
153
153
  assert count > 0, 'no thumbnails found'
154
154
  end
155
+
156
+ def test_should_not_loop_endlessly
157
+ TIFF.new(f('endless-loop.exif'))
158
+ assert true
159
+ end
155
160
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exifr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.W. van 't Veer
@@ -9,7 +9,7 @@ autorequire: exifr
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-28 00:00:00 +01:00
12
+ date: 2008-01-14 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -37,6 +37,7 @@ files:
37
37
  - tests/data/canon-g3.exif
38
38
  - tests/data/Canon_PowerShot_A85.exif
39
39
  - tests/data/Casio-EX-S20.exif
40
+ - tests/data/endless-loop.exif
40
41
  - tests/data/exif.jpg
41
42
  - tests/data/FUJIFILM-FinePix_S3000.exif
42
43
  - tests/data/gps.exif