mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-28 02:04:36 +03:00
commit
76115e3c1b
|
@ -123,7 +123,7 @@ def test_no_icc_profile():
|
||||||
|
|
||||||
|
|
||||||
def test_combined_larger_than_size():
|
def test_combined_larger_than_size():
|
||||||
# The 'combined' sizes of the individual parts is larger than the
|
# The combined size of the individual parts is larger than the
|
||||||
# declared 'size' of the extra data field, resulting in a backwards seek.
|
# declared 'size' of the extra data field, resulting in a backwards seek.
|
||||||
|
|
||||||
# If we instead take the 'size' of the extra data field as the source of truth,
|
# If we instead take the 'size' of the extra data field as the source of truth,
|
||||||
|
|
|
@ -195,7 +195,6 @@ def _layerinfo(fp, ct_bytes):
|
||||||
x1 = i32(read(4))
|
x1 = i32(read(4))
|
||||||
|
|
||||||
# image info
|
# image info
|
||||||
info = []
|
|
||||||
mode = []
|
mode = []
|
||||||
ct_types = i16(read(2))
|
ct_types = i16(read(2))
|
||||||
types = list(range(ct_types))
|
types = list(range(ct_types))
|
||||||
|
@ -211,8 +210,7 @@ def _layerinfo(fp, ct_bytes):
|
||||||
m = "RGBA"[type]
|
m = "RGBA"[type]
|
||||||
|
|
||||||
mode.append(m)
|
mode.append(m)
|
||||||
size = i32(read(4))
|
read(4) # size
|
||||||
info.append((m, size))
|
|
||||||
|
|
||||||
# figure out the image mode
|
# figure out the image mode
|
||||||
mode.sort()
|
mode.sort()
|
||||||
|
@ -229,26 +227,22 @@ def _layerinfo(fp, ct_bytes):
|
||||||
read(12) # filler
|
read(12) # filler
|
||||||
name = ""
|
name = ""
|
||||||
size = i32(read(4)) # length of the extra data field
|
size = i32(read(4)) # length of the extra data field
|
||||||
combined = 0
|
|
||||||
if size:
|
if size:
|
||||||
data_end = fp.tell() + size
|
data_end = fp.tell() + size
|
||||||
|
|
||||||
length = i32(read(4))
|
length = i32(read(4))
|
||||||
if length:
|
if length:
|
||||||
fp.seek(length - 16, io.SEEK_CUR)
|
fp.seek(length - 16, io.SEEK_CUR)
|
||||||
combined += length + 4
|
|
||||||
|
|
||||||
length = i32(read(4))
|
length = i32(read(4))
|
||||||
if length:
|
if length:
|
||||||
fp.seek(length, io.SEEK_CUR)
|
fp.seek(length, io.SEEK_CUR)
|
||||||
combined += length + 4
|
|
||||||
|
|
||||||
length = i8(read(1))
|
length = i8(read(1))
|
||||||
if length:
|
if length:
|
||||||
# Don't know the proper encoding,
|
# Don't know the proper encoding,
|
||||||
# Latin-1 should be a good guess
|
# Latin-1 should be a good guess
|
||||||
name = read(length).decode("latin-1", "replace")
|
name = read(length).decode("latin-1", "replace")
|
||||||
combined += length + 1
|
|
||||||
|
|
||||||
fp.seek(data_end)
|
fp.seek(data_end)
|
||||||
layers.append((name, mode, (x0, y0, x1, y1)))
|
layers.append((name, mode, (x0, y0, x1, y1)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user