From 4680dbcc55d336aaa04d9ee32b2fce4cebf5d962 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 21 Oct 2017 12:40:13 +0100 Subject: [PATCH] [Feature] Filter nan and inf when adding scores MFH: rspamd-1.6 --- src/libmime/filter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libmime/filter.c b/src/libmime/filter.c index b16018507..235d46ede 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -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; -- 2.39.5