]> 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)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 21 Oct 2017 11:40:13 +0000 (12:40 +0100)
MFH: rspamd-1.6

src/libmime/filter.c

index 5bbdd87e7a41ab7db50b08334fdb9cb6760b6ac2..13b48cfda4ac9d378fe1760f597739be0afb28be 100644 (file)
@@ -110,6 +110,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;