[Spambayes]
[ spambayes-Bugs-696458 ] crash in tokenizer due to bad base64 in
subject
SourceForge.net
noreply at sourceforge.net
Mon Mar 3 08:44:15 EST 2003
Bugs item #696458, was opened at 2003-03-03 11:12
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=696458&group_id=61702
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sjoerd Mullender (sjoerd)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash in tokenizer due to bad base64 in subject
Initial Comment:
I got a crash in the tokenizer in the line where it does
x = msg.get('subject', '')
for x, subjcharset in
email.Header.decode_header(x):
The reason is, the subject of this particular message is
Subject: *****SPAM*****
=?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?=
which gives a binascii.Error: Incorrect padding from
binascii.a2b_base64.
I am running an up-to-date spambayes and python (i.e.
both fresh from CVS).
Here is a (parial) stack trace:
File
"/ufs/sjoerd/src/spambayes/spambayes/tokenizer.py",
line 1052, in tokenize
for tok in self.tokenize_headers(msg):
File
"/ufs/sjoerd/src/spambayes/spambayes/tokenizer.py",
line 1106, in tokenize_headers
for x, subjcharset in email.Header.decode_header(x):
File
"/ufs/sjoerd/src/Python/dist/src/Lib/email/Header.py",
line 92, in decode_header
dec = email.base64MIME.decode(encoded)
File
"/ufs/sjoerd/src/Python/dist/src/Lib/email/base64MIME.py",
line 179, in decode
dec = a2b_base64(s)
binascii.Error: Incorrect padding
----------------------------------------------------------------------
>Comment By: Sjoerd Mullender (sjoerd)
Date: 2003-03-03 17:44
Message:
Logged In: YES
user_id=43607
It seems to me that all calls to email.Header.decode_header
should be protected with try/except, or decode_header itself
should protect itself with a try/except. A third
possibility is to add an extra indirection through a
function that does basically:
def decode_header(x):
try:
return email.Header.decode_header(x)
except:
return x
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=696458&group_id=61702
More information about the Spambayes
mailing list