]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Filter nan and inf when adding scores
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 21 Oct 2017 11:40:13 +0000 (12:40 +0100)
committerAndrew Lewis <nerf@judo.za.org>
Sat, 21 Oct 2017 19:03:21 +0000 (21:03 +0200)
MFH: rspamd-1.6

src/libmime/filter.c

index b16018507eea72e3db421cf460e3cc49369f9509..235d46ede112edd8d6d47daebbac94b622883479 100644 (file)
@@ -109,6 +109,12 @@ insert_metric_result (struct rspamd_task *task,
 
        metric_res = rspamd_create_metric_result (task);
 
+       if (!isfinite (flag)) {
+               msg_warn_task ("detected %s score for symbol %s, replace it with zero",
+                               isnan (flag) ? "NaN" : "infinity", symbol);
+               flag = 0.0;
+       }
+
        sdef = g_hash_table_lookup (metric->symbols, symbol);
        if (sdef == NULL) {
                w = 0.0;