From: Vsevolod Stakhov Date: Sat, 21 Oct 2017 11:40:13 +0000 (+0100) Subject: [Feature] Filter nan and inf when adding scores X-Git-Tag: 1.6.5~1^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4680dbcc55d336aaa04d9ee32b2fce4cebf5d962;p=rspamd.git [Feature] Filter nan and inf when adding scores MFH: rspamd-1.6 --- 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;