Catch OverflowError in SpiderImagePlugin

This commit is contained in:
Andrew Murray 2015-11-18 01:18:01 +11:00
parent 6cacfc8909
commit 4d7b630b33
3 changed files with 7 additions and 0 deletions

View File

@ -50,6 +50,8 @@ def isInt(f):
return 0
except ValueError:
return 0
except OverflowError:
return 0
iforms = [1, 3, -11, -12, -21, -22]

BIN
Tests/images/invalid.spider Normal file

Binary file not shown.

View File

@ -80,6 +80,11 @@ class TestImageSpider(PillowTestCase):
# Assert
self.assertEqual(ret, 0)
def test_invalid_file(self):
invalid_file = "Tests/images/invalid.spider"
self.assertRaises(IOError, lambda: Image.open(invalid_file))
if __name__ == '__main__':
unittest.main()