Permalink
Browse files

#22403 Wrong file size reported

  • Loading branch information...
1 parent 9f9d327 commit 928beeaffdb95837bf533822409532429fb6f53d @remvee remvee committed Oct 15, 2008
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/tiff.rb
View
@@ -319,7 +319,10 @@ def readlong(pos); self[pos..(pos + 3)].unpack(@long)[0]; end
end
@ifds = [IFD.new(data)]
- while ifd = @ifds.last.next; @ifds << ifd; end
+ while ifd = @ifds.last.next
+ break if @ifds.find{|i| i.offset == ifd.offset}
+ @ifds << ifd
+ end
@jpeg_thumbnails = @ifds.map do |ifd|
if ifd.jpeg_interchange_format && ifd.jpeg_interchange_format_length
@@ -388,7 +391,7 @@ def inspect # :nodoc:
end
class IFD # :nodoc:
- attr_reader :type, :fields
+ attr_reader :type, :fields, :offset
def initialize(data, offset = nil, type = :image)
@data, @offset, @type, @fields = data, offset, type, {}
@@ -431,7 +434,7 @@ def inspect
end
def next?
- @offset_next != 0 && @offset_next < @data.size && (@offset || 0) < @offset_next
+ @offset_next != 0 && @offset_next < @data.size
end
def next

0 comments on commit 928beea

Please sign in to comment.