exifr 0.10.8 → 0.10.9

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,8 @@
1
+ EXIF Reader 0.10.9
2
+ * bug fix; "[GH#1] user_comment returns nil for jpeg with UserComment"; thanks to Mark Lundquist
3
+ * bug fix; "[GH#2] Nil pointer in tiff.rb"
4
+ * enhancement; "don't read entire files into memory"; thanks to Victor Bogado
5
+
1
6
  EXIF Reader 0.10.8
2
7
  * feature request; "[#23694] The object interface of JPEG is different from the TIFF one."
3
8
 
data/lib/tiff.rb CHANGED
@@ -492,7 +492,8 @@ module EXIFR
492
492
 
493
493
  if len && pack && @type != 7
494
494
  start = len > 4 ? @offset : (pos + 8)
495
- @value = [pack[data[start..(start + len - 1)]]].flatten
495
+ d = data[start..(start + len - 1)]
496
+ @value = d && [pack[d]].flatten
496
497
  end
497
498
  end
498
499
  end
@@ -521,7 +522,7 @@ module EXIFR
521
522
  read_for(pos)
522
523
  end
523
524
 
524
- @buffer[(pos.begin - @pos)..(pos.end - @pos)]
525
+ @buffer && @buffer[(pos.begin - @pos)..(pos.end - @pos)]
525
526
  end
526
527
 
527
528
  def readshort(pos)
Binary file
Binary file
data/tests/tiff_test.rb CHANGED
@@ -91,7 +91,7 @@ class TIFFTest < Test::Unit::TestCase
91
91
  assert_equal [678886.quo(100000), 0.quo(1), 0.quo(1)], t.gps_longitude
92
92
  assert_equal 'WGS84', t.gps_map_datum
93
93
 
94
- (all_test_exifs - [f('gps.exif'), f('user-comment.exif')]).each do |fname|
94
+ (all_test_exifs - %w(gps user-comment out-of-range).map{|v| f("#{v}.exif")}).each do |fname|
95
95
  assert_nil TIFF.new(fname).gps_version_id
96
96
  end
97
97
  end
@@ -166,4 +166,10 @@ class TIFFTest < Test::Unit::TestCase
166
166
  def test_user_comment
167
167
  assert_equal "Manassas Battlefield", TIFF.new(f('user-comment.exif')).user_comment
168
168
  end
169
+
170
+ def test_handle_out_of_range_offset
171
+ assert_nothing_raised do
172
+ assert 'NIKON', TIFF.new(f('out-of-range.exif')).make
173
+ end
174
+ end
169
175
  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.8
4
+ version: 0.10.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.W. van 't Veer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-01 00:00:00 +02:00
12
+ date: 2009-11-10 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -29,23 +29,25 @@ files:
29
29
  - lib/jpeg.rb
30
30
  - lib/tiff.rb
31
31
  - tests/data/1x1.jpg
32
- - tests/data/apple-aperture-1.5.exif
33
- - tests/data/canon-g3.exif
34
32
  - tests/data/Canon_PowerShot_A85.exif
35
33
  - tests/data/Casio-EX-S20.exif
34
+ - tests/data/FUJIFILM-FinePix_S3000.exif
35
+ - tests/data/Panasonic-DMC-LC33.exif
36
+ - tests/data/Trust-DC3500_MINI.exif
37
+ - tests/data/apple-aperture-1.5.exif
38
+ - tests/data/canon-g3.exif
36
39
  - tests/data/endless-loop.exif
37
40
  - tests/data/exif.jpg
38
- - tests/data/FUJIFILM-FinePix_S3000.exif
39
41
  - tests/data/gps.exif
40
42
  - tests/data/image.jpg
41
43
  - tests/data/multiple-app1.jpg
42
44
  - tests/data/nikon_d1x.tif
43
- - tests/data/Panasonic-DMC-LC33.exif
45
+ - tests/data/out-of-range.exif
44
46
  - tests/data/plain.tif
45
- - tests/data/Trust-DC3500_MINI.exif
47
+ - tests/data/user-comment.exif
46
48
  - tests/data/weird_date.exif
47
- - tests/test_helper.rb
48
49
  - tests/jpeg_test.rb
50
+ - tests/test_helper.rb
49
51
  - tests/tiff_test.rb
50
52
  - README.rdoc
51
53
  - CHANGELOG