]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Avoid returning NaN as score on scan 798/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 2 Aug 2016 23:46:38 +0000 (01:46 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 2 Aug 2016 23:46:38 +0000 (01:46 +0200)
src/libserver/protocol.c

index cb1e3dc308290ea0ac594e970e6411e21b5c4c99..32f4bb02b9dd65186bef29097e7b48e5814bbffa 100644 (file)
@@ -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);