From ff7962c3be5eac5103978fde8f8e14dc6542b8dc Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 4 Feb 2016 04:17:00 -0800 Subject: [PATCH] test for #1711 --- Tests/test_image_resample.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Tests/test_image_resample.py diff --git a/Tests/test_image_resample.py b/Tests/test_image_resample.py new file mode 100644 index 000000000..f274322e5 --- /dev/null +++ b/Tests/test_image_resample.py @@ -0,0 +1,18 @@ +from helper import unittest, PillowTestCase, hopper +from PIL import Image + +class TestImagingCoreResize(PillowTestCase): + #see https://github.com/python-pillow/Pillow/issues/1710 + def test_overflow(self): + im = hopper('L') + xsize = 0x100000008 // 4 + ysize = 1000 # unimportant + try: + im.im.resize((xsize, ysize), Image.LINEAR) # any resampling filter will do here + self.fail("Resize should raise MemoryError on invalid xsize") + except MemoryError: + self.assertTrue(True, "Should raise MemoryError") + + +if __name__ == '__main__': + unittest.main()