File 0013-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
@@ -369,6 +369,11 @@ def test_deprecation_warning_with_spaces(self):
         self.assertEqual(im.tag.tags[X_RESOLUTION][0][0], 36)
         self.assertEqual(im.tag.tags[Y_RESOLUTION][0][0], 72)
 
+    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")
+
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py
index 9fcffb7427..a927cd3ed9 100644
--- a/PIL/TiffImagePlugin.py
+++ b/PIL/TiffImagePlugin.py
@@ -799,8 +799,8 @@ def _setup(self):
             print("- fill_order:", fillorder)
 
         # size
-        xsize = getscalar(IMAGEWIDTH)
-        ysize = getscalar(IMAGELENGTH)
+        xsize = int(getscalar(IMAGEWIDTH))
+        ysize = int(getscalar(IMAGELENGTH))
         self.size = xsize, ysize
 
         if Image.DEBUG:
openSUSE Build Service is sponsored by