From: Andrew Lewis Date: Tue, 2 Aug 2016 23:46:38 +0000 (+0200) Subject: [Fix] Avoid returning NaN as score on scan X-Git-Tag: 1.3.2~62^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F798%2Fhead;p=rspamd.git [Fix] Avoid returning NaN as score on scan --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index cb1e3dc30..32f4bb02b 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -859,8 +859,13 @@ rspamd_metric_result_ucl (struct rspamd_task *task, ucl_object_insert_key (obj, ucl_object_frombool (RSPAMD_TASK_IS_SKIPPED (task)), "is_skipped", 0, false); - ucl_object_insert_key (obj, ucl_object_fromdouble (mres->score), + if (!isnan (mres->score)) { + ucl_object_insert_key (obj, ucl_object_fromdouble (mres->score), "score", 0, false); + } else { + ucl_object_insert_key (obj, + ucl_object_fromdouble (0.0), "score", 0, false); + } ucl_object_insert_key (obj, ucl_object_fromdouble (rspamd_task_get_required_score (task, mres)), "required_score", 0, false);