mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-09 00:02:49 -04:00
Fixes infinite loop with certain jpegs, adds test. Fixes #19.
This commit is contained in:
parent
6913762c93
commit
63b97f7ef0
@ -445,8 +445,9 @@ class FastImage
|
|||||||
end
|
end
|
||||||
|
|
||||||
next_offset = get_chars(4).unpack(@long)[0]
|
next_offset = get_chars(4).unpack(@long)[0]
|
||||||
if next_offset > 0
|
relative_offset = next_offset - (@bytes_delivered - @exif_start_byte)
|
||||||
get_chars(next_offset - (@bytes_delivered - @exif_start_byte))
|
if relative_offset >= 0
|
||||||
|
get_chars(relative_offset)
|
||||||
parse_exif_ifd
|
parse_exif_ifd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
BIN
test/fixtures/infinite.jpg
vendored
Normal file
BIN
test/fixtures/infinite.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@ -19,7 +19,8 @@ GoodFixtures = {
|
|||||||
"test3.jpg"=>[:jpeg, [630, 367]],
|
"test3.jpg"=>[:jpeg, [630, 367]],
|
||||||
"test.tiff"=>[:tiff, [85, 67]],
|
"test.tiff"=>[:tiff, [85, 67]],
|
||||||
"test2.tiff"=>[:tiff, [333, 225]],
|
"test2.tiff"=>[:tiff, [333, 225]],
|
||||||
"exif_orientation.jpg"=>[:jpeg, [2448, 3264]]
|
"exif_orientation.jpg"=>[:jpeg, [2448, 3264]],
|
||||||
|
"infinite.jpg"=>[:jpeg, [160,240]]
|
||||||
}
|
}
|
||||||
|
|
||||||
BadFixtures = [
|
BadFixtures = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user