[spambayes-dev] spambayes crash due to bad image

Sjoerd Mullender sjoerd at acm.org
Thu May 24 16:20:53 CEST 2007


I got this crash, probably due to a bad image.  The code in
ImageStripper.py that calls PIL is currently in a except IOError, but
should probably be in a bare except to catch any and all errors from
PIL.  In my case I got an IndexError.

I could make this change, if there is consensus and once Sourceforge
lets me get at the spambayes repository.


16:02:17+ sb_imapfilter.py -c
SpamBayes IMAP Filter Version 1.1a3 (August 2006).

Traceback (most recent call last):
  File "/ufs/sjoerd/bin/x86_64/sb_imapfilter.py", line 1301, in <module>
    run()
  File "/ufs/sjoerd/bin/x86_64/sb_imapfilter.py", line 1281, in run
    imap_filter.Filter()
  File "/ufs/sjoerd/bin/x86_64/sb_imapfilter.py", line 1080, in Filter
    self.unsure_folder, self.ham_folder)
  File "/ufs/sjoerd/bin/x86_64/sb_imapfilter.py", line 955, in Filter
    evidence=True)
  File
"/ufs/sjoerd/lib/python2.6/site-packages/spambayes/classifier.py", line
196, in chi2_spamprob
    clues = self._getclues(wordstream)
  File
"/ufs/sjoerd/lib/python2.6/site-packages/spambayes/classifier.py", line
498, in _getclues
    for word in Set(wordstream):
  File "/ufs/sjoerd/lib/python2.6/site-packages/spambayes/tokenizer.py",
line 1284, in tokenize
    for tok in self.tokenize_body(msg):
  File "/ufs/sjoerd/lib/python2.6/site-packages/spambayes/tokenizer.py",
line 1643, in tokenize_body
    text, tokens = crack_images(engine_name, parts)
  File
"/ufs/sjoerd/lib/python2.6/site-packages/spambayes/ImageStripper.py",
line 367, in analyze
    pnmfiles, tokens = PIL_decode_parts(parts)
  File
"/ufs/sjoerd/lib/python2.6/site-packages/spambayes/ImageStripper.py",
line 144, in PIL_decode_parts
    image.load()
  File "/ufs/sjoerd/lib/python2.6/site-packages/PIL/ImageFile.py", line
189, in load
    s = read(self.decodermaxblock)
  File "/ufs/sjoerd/lib/python2.6/site-packages/PIL/PngImagePlugin.py",
line 349, in load_read
    cid, pos, len = self.png.read()
  File "/ufs/sjoerd/lib/python2.6/site-packages/PIL/PngImagePlugin.py",
line 92, in read
    len = i32(s)
  File "/ufs/sjoerd/lib/python2.6/site-packages/PIL/PngImagePlugin.py",
line 40, in i32
    return ord(c[3]) + (ord(c[2])<<8) + (ord(c[1])<<16) + (ord(c[0])<<24)
IndexError: string index out of range

-- 
Sjoerd Mullender

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 369 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/spambayes-dev/attachments/20070524/86a69f3b/attachment.pgp 


More information about the spambayes-dev mailing list