Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Cloud:OpenStack:Pike
python-Pillow
004-Raise-error-if-dimension-is-a-string.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 004-Raise-error-if-dimension-is-a-string.patch of Package python-Pillow
From 9a977b975cd871ef9a9128b72414c0de3a292591 Mon Sep 17 00:00:00 2001 From: Andrew Murray <radarhere@users.noreply.github.com> Date: Sun, 29 Sep 2019 14:15:48 +1000 Subject: [PATCH] Raise error if dimension is a string --- Tests/test_file_tiff.py | 5 +++++ src/PIL/TiffImagePlugin.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 2baeb6ae05..2d15de2bd5 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -494,6 +494,11 @@ def test_close_on_load_nonexclusive(self): 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): def test_fd_leak(self): diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 9fcffb7427..a927cd3ed9 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -1129,8 +1129,8 @@ def _setup(self): print("- fill_order:", fillorder) # 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:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor