mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Added test for bad EXIF data
This commit is contained in:
parent
ed2cca1e71
commit
109ec638d9
BIN
Tests/images/hopper_bad_exif.jpg
Normal file
BIN
Tests/images/hopper_bad_exif.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 KiB |
|
@ -3,6 +3,8 @@ from helper import unittest, PillowTestCase, hopper, py3
|
||||||
|
|
||||||
from PIL import Image, TiffImagePlugin
|
from PIL import Image, TiffImagePlugin
|
||||||
|
|
||||||
|
import struct
|
||||||
|
|
||||||
|
|
||||||
class TestFileTiff(PillowTestCase):
|
class TestFileTiff(PillowTestCase):
|
||||||
|
|
||||||
|
@ -77,6 +79,12 @@ class TestFileTiff(PillowTestCase):
|
||||||
im._setup()
|
im._setup()
|
||||||
self.assertEqual(im.info['dpi'], (72., 72.))
|
self.assertEqual(im.info['dpi'], (72., 72.))
|
||||||
|
|
||||||
|
def test_bad_exif(self):
|
||||||
|
try:
|
||||||
|
Image.open('Tests/images/hopper_bad_exif.jpg')._getexif()
|
||||||
|
except struct.error:
|
||||||
|
self.fail("Bad EXIF data should not pass incorrect values to _binary unpack")
|
||||||
|
|
||||||
def test_little_endian(self):
|
def test_little_endian(self):
|
||||||
im = Image.open('Tests/images/16bit.cropped.tif')
|
im = Image.open('Tests/images/16bit.cropped.tif')
|
||||||
self.assertEqual(im.getpixel((0, 0)), 480)
|
self.assertEqual(im.getpixel((0, 0)), 480)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user