Subject: Re: Spam that makes SpamAssassin crash Perl
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Rhialto <rhialto@azenomei.knuffel.net>
List: port-alpha
Date: 11/28/2003 00:05:36
On Thu 27 Nov 2003 at 23:37:52 +0100, Rhialto wrote:
> I am running it now under a line-by-line trace as suggested in the
> perlrun(1) page in the section on the -D option. It is still running (it
> is a lot slower this way).
The tail of the output is like this:
1163: foreach my $prob (@sorted) {
1164: $S *= 1.0 - $prob;
1165: $H *= $prob;
1166: if ($S < 1e-200) {
1171: if ($H < 1e-200) {
many repetitions of the above block, then
1163: foreach my $prob (@sorted) {
1164: $S *= 1.0 - $prob;
1165: $H *= $prob;
1166: if ($S < 1e-200) {
1171: if ($H < 1e-200) {
1163: foreach my $prob (@sorted) {
1180: $S = log($S) + $Sexp * LN2;
entering CODE(0x12188bbb0)
91: *$full_name = sub () { $scalar };
exited CODE(0x12188bbb0)
1181: $H = log($H) + $Hexp * LN2;
entering CODE(0x12188bbb0)
91: *$full_name = sub () { $scalar };
exited CODE(0x12188bbb0)
1183: my $result;
1184: if ($num_clues) {
1185: $S = 1.0 - chi2q(-2.0 * $S, 2 * $num_clues);
entering Mail::SpamAssassin::Bayes::chi2q
1136: my ($x2, $v) = @_;
1138: die "v must be even in chi2q(x2, v)" if $v & 1;
1139: my $m = $x2 / 2.0;
1140: my ($sum, $term);
1141: $sum = $term = exp(0 - $m);
Floating point exception
$m is apparently 736.285624221884. And indeed, the following also crashes:
$ perl -e 'print exp(0 - 736.285624221884), "\n";'
Floating point exception (core dumped)
This is ok:
$ perl -e 'print exp(0 - 708), "\n";'
3.30755300363841e-308
So it must be underflow that is trapping...
Next question: how to fix that?
-Olaf.
--
___ Olaf 'Rhialto' Seibert
\X/ rhialto/at/xs4all.nl -- Cetero censeo "authored" delendum esse.