Closed Bug 215701 Opened 21 years ago Closed 18 years ago

hang while reading tokens for junk mail due to corrupt training.dat

Categories

(MailNews Core :: Filters, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ajschult784, Assigned: ajschult784)

References

Details

(Keywords: hang, verified1.8.1.2)

Attachments

(3 files)

Mozilla hangs while downloading a piece of spam.  debugging shows that it's hung
up in readTokens in nsBayesianFilter.cpp
Attached file stacktrace
0x460a831e in readTokens (stream=0x89d6878, tokenizer=@0x882d4ac) at
nsBayesianFilter.cpp:925
925			newBufferSize *= 2;
(gdb) p tokenCount
$1 = 25484
(gdb) p i
$2 = 17664
(gdb) p size
$3 = 3267347362     <== impressive
(gdb) p newBufferSize
$4 = 0
(gdb) p bufferSize
$5 = 0
Attached file bzip2ed training.dat
a clean profile can successfully download mail.  clean profile with this
training.dat file hangs downloading the mail.

I also tried deleting the specific piece of spam that was causing the hang
before, and the clean profile hung on a different one.
a clean profile could download the mail properly.  a clean profile with my
training.dat file hit this bug.
Summary: hang while reading tokens for junk mail → hang while reading tokens for junk mail due to corrupt training.dat
looking at the training.dat file, there seem to be a couple sections that are
uncharacteristic.  the first such section looks like a xine configuration file.
 My system was having trouble distinguishing up from down for a while, and so
the file getting corrupted is probably INVALID.  lowering severity.

it would still be nice if Mozilla didn't hang...
Severity: critical → major
Product: MailNews → Core
hang=critical

blocking bug 262743 and bug 317798 on the probability that these are related. 
bug 317798 also has a test training.dat file.
also related? bug 285927, bug 240788
Assignee: sspitzer → nobody
Blocks: 262743, 317798
Severity: major → critical
QA Contact: laurel → filters
bug 240788 helped here, but we still attempt to allocate 2GB of memory on bogus sizes (which would bring things to a stand-still).  Also, if a 2GB token *was* read in and then the next token claimed to be bigger, we'd still hit unchecked overflow.

I'm not sure what mGoodCount and mBadCount have as a purpose in life, but if they're supposed to be related to the number of tokens, then this code needs to update their values on failure.
Assignee: nobody → ajschult
Status: NEW → ASSIGNED
Attachment #239465 - Flags: superreview?(bienvenu)
Attachment #239465 - Flags: review?(mscott)
Comment on attachment 239465 [details] [diff] [review]
don't try to allocate memory that has no chance of being used

this looks ok to me, but I haven't tried it out...
Attachment #239465 - Flags: superreview?(bienvenu) → superreview+
OS=ALL?
Attachment #239465 - Flags: review?(mscott) → review+
FIXED
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
No longer blocks: 317798
Comment on attachment 239465 [details] [diff] [review]
don't try to allocate memory that has no chance of being used

after sufficient baking of course.
Attachment #239465 - Flags: approval1.8.1?
Attachment #239465 - Flags: approval1.8.1? → approval-thunderbird2?
Comment on attachment 239465 [details] [diff] [review]
don't try to allocate memory that has no chance of being used

I think this has had sufficient bake time :)
Attachment #239465 - Flags: approval-thunderbird2? → approval-thunderbird2+
Scott, can you grant approval for bug 240788 as well?  It'd be easier if this one doesn't land first.
(In reply to comment #12)
> Scott, can you grant approval for bug 240788 as well?  It'd be easier if this
> one doesn't land first.
> 

done! Thanks for pointing that bug out.
landed on branch
Keywords: fixed1.8.1.2
Verified for 1.8.1.2 with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2pre) Gecko/20070105 Thunderbird/2.0b1 ID:2007010503 on Fedora FC 6 with testcase training.dat
Status: RESOLVED → VERIFIED
No longer blocks: 262743
OS: Linux → All
Hardware: PC → All
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.