mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #2 from radarhere/fix_jpeg_magic_number
Updated _open check to match _accept
This commit is contained in:
commit
b7b4aaceeb
|
@ -338,10 +338,11 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
|
||||
def _open(self):
|
||||
|
||||
s = self.fp.read(1)
|
||||
s = self.fp.read(3)
|
||||
|
||||
if i8(s) != 255:
|
||||
if s != b"\xFF\xD8\xFF":
|
||||
raise SyntaxError("not a JPEG file")
|
||||
s = b"\xFF"
|
||||
|
||||
# Create attributes
|
||||
self.bits = self.layers = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user