sanity check on ascii integers

This commit is contained in:
wiredfool 2014-04-08 22:43:57 -07:00
parent 213cec00cb
commit 88e235f3f5

View File

@ -63,7 +63,11 @@ class PpmImageFile(ImageFile.ImageFile):
c = self.fp.read(1)
if not c or c in b_whitespace:
break
if c > b'\x79':
raise ValueError("Expected ASCII value, found binary")
s = s + c
if (len(s) > 9):
raise ValueError("Expected int, got > 9 digits")
return s
def _open(self):