]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not break history on NaN in required score
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Jul 2016 15:30:31 +0000 (16:30 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Jul 2016 15:32:01 +0000 (16:32 +0100)
Issue: #763
Reported by: @fatalbanana

src/controller.c

index 103f97be5bc90e8ecf9baaa635258ec08a8547c3..394110d0ad5c3ead4dadc35856c2c8a05a4cc6b8 100644 (file)
@@ -1277,9 +1277,17 @@ rspamd_controller_handle_history (struct rspamd_http_connection_entry *conn_ent,
                                        row->action)), "action", 0, false);
                        ucl_object_insert_key (obj, ucl_object_fromdouble (
                                        row->score),              "score",                      0, false);
-                       ucl_object_insert_key (obj,
-                               ucl_object_fromdouble (
-                                       row->required_score), "required_score", 0, false);
+
+                       if (!isnan (row->required_score)) {
+                               ucl_object_insert_key (obj,
+                                               ucl_object_fromdouble (
+                                                               row->required_score), "required_score", 0, false);
+                       }
+                       else {
+                               ucl_object_insert_key (obj,
+                                               ucl_object_fromdouble (0.0), "required_score", 0, false);
+                       }
+
                        ucl_object_insert_key (obj, ucl_object_fromstring (
                                        row->symbols),            "symbols",            0, false);
                        ucl_object_insert_key (obj,        ucl_object_fromint (