Handle tiff format with long dimension values, fixes #158

This commit is contained in:
Stephen Sykes 2025-01-02 20:25:48 +00:00
parent a891d8f43a
commit cad7175e06
3 changed files with 11 additions and 3 deletions

View File

@ -30,8 +30,16 @@ module FastImageParsing
tag_count = @stream.read(2).unpack(@short)[0]
tag_count.downto(1) do
type = @stream.read(2).unpack(@short)[0]
@stream.read(6)
data = @stream.read(2).unpack(@short)[0]
data_type = @stream.read(2).unpack(@short)[0]
@stream.read(4)
if data_type == 4
data = @stream.read(4).unpack(@long)[0]
else
data = @stream.read(2).unpack(@short)[0]
@stream.read(2)
end
case type
when 0x0100 # image width
@width = data
@ -43,7 +51,6 @@ module FastImageParsing
if @width && @height && @orientation
return # no need to parse more
end
@stream.read(2)
end
end

BIN
test/fixtures/test.dng vendored Normal file

Binary file not shown.

View File

@ -60,6 +60,7 @@ GoodFixtures = {
"avif/red_green_flash.avif" => [:avif, [256, 256]],
"isobmff.jxl" => [:jxl, [1280,1600]],
"naked.jxl" => [:jxl, [1000,1000]],
"test.dng" => [:tiff, [4032, 3024]]
}
BadFixtures = [