[Image-SIG] memoryError in FpxImageUploadPlugin.py

Gábor Farkas gabor at nekomancer.net
Fri Apr 15 15:37:51 CEST 2011


hi,

we have a python webserver that handles files uploaded by the users.
some of those files cause a MemoryError in PIL.
(unfortunately i do not have such a file). as you can see, it happens
in the FpxImagPlugin:
(pil 1.1.7)

   im = Image.open(original)
 File "/usr/local/lib/python2.6/site-packages/PIL/Image.py", line 1976, in open
   return factory(fp, filename)
 File "/usr/local/lib/python2.6/site-packages/PIL/ImageFile.py", line
91, in __init__
   self._open()
 File "/usr/local/lib/python2.6/site-packages/PIL/FpxImagePlugin.py",
line 61, in _open
   self.ole = OleFileIO(self.fp)
 File "/usr/local/lib/python2.6/site-packages/PIL/OleFileIO.py", line
260, in __init__
   self.open(filename)
 File "/usr/local/lib/python2.6/site-packages/PIL/OleFileIO.py", line
289, in open
   self.loadfat(header)
 File "/usr/local/lib/python2.6/site-packages/PIL/OleFileIO.py", line
309, in loadfat
   s = self.getsect(ix)
 File "/usr/local/lib/python2.6/site-packages/PIL/OleFileIO.py", line
324, in getsect
   self.fp.seek(512 + self.sectorsize * sect)
MemoryError

any ideas what might cause this?

alternatively, is there a way to tell PIL to only try to handle a
given list of file-types?
for example, in my cases, i only care about JPG/PNG/GIF... so i do not need PIL
to try to find out if the file is in other formats.. is there any way
do a fileformat-whitelist?

thanks,
gabor


More information about the Image-SIG mailing list