aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-21 12:40:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-21 12:40:13 +0100
commit044f90245af052b7742271843fe3918439dfbe3a (patch)
tree4f71fd4f3907fe7c7f0518c95867fa3d21531aa6
parentb36b03e17525007976d21f02d0e5949691e3c439 (diff)
downloadrspamd-044f90245af052b7742271843fe3918439dfbe3a.tar.gz
rspamd-044f90245af052b7742271843fe3918439dfbe3a.zip
[Feature] Filter nan and inf when adding scores
MFH: rspamd-1.6
-rw-r--r--src/libmime/filter.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index 5bbdd87e7..13b48cfda 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -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;