mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Discard first byte if not 0xFF (for issue #630)
This commit is contained in:
parent
73eafbb55f
commit
e835dd70a1
|
@ -290,9 +290,14 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
|
||||
while True:
|
||||
|
||||
i = i8(s)
|
||||
if i == 0xFF:
|
||||
s = s + self.fp.read(1)
|
||||
|
||||
i = i16(s)
|
||||
else:
|
||||
# Skip non-0xFF junk
|
||||
s = "\xff"
|
||||
continue
|
||||
|
||||
if i in MARKER:
|
||||
name, description, handler = MARKER[i]
|
||||
|
@ -307,7 +312,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
# self.__offset = self.fp.tell()
|
||||
break
|
||||
s = self.fp.read(1)
|
||||
elif i == 0 or i == 65535:
|
||||
elif i == 0 or i == 0xFFFF:
|
||||
# padded marker or junk; move on
|
||||
s = "\xff"
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user