mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #4103 from radarhere/dimension
Raise error if TIFF dimension is a string
This commit is contained in:
commit
b9693a51c9
BIN
Tests/images/string_dimension.tiff
Normal file
BIN
Tests/images/string_dimension.tiff
Normal file
Binary file not shown.
|
@ -587,6 +587,11 @@ class TestFileTiff(PillowTestCase):
|
|||
im.load()
|
||||
self.assertFalse(fp.closed)
|
||||
|
||||
def test_string_dimension(self):
|
||||
# Assert that an error is raised if one of the dimensions is a string
|
||||
with self.assertRaises(ValueError):
|
||||
Image.open("Tests/images/string_dimension.tiff")
|
||||
|
||||
|
||||
@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only")
|
||||
class TestFileTiffW32(PillowTestCase):
|
||||
|
|
|
@ -1239,8 +1239,8 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
print("- YCbCr subsampling:", self.tag.get(530))
|
||||
|
||||
# size
|
||||
xsize = self.tag_v2.get(IMAGEWIDTH)
|
||||
ysize = self.tag_v2.get(IMAGELENGTH)
|
||||
xsize = int(self.tag_v2.get(IMAGEWIDTH))
|
||||
ysize = int(self.tag_v2.get(IMAGELENGTH))
|
||||
self._size = xsize, ysize
|
||||
|
||||
if DEBUG:
|
||||
|
|
Loading…
Reference in New Issue
Block a user