From: Vsevolod Stakhov Date: Wed, 25 Jan 2017 13:37:51 +0000 (+0000) Subject: [Minor] Add additional safe guard for nan values X-Git-Tag: 1.5.0~260 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e6c0c12f65a9b0405ec3cebd2cdebda57dfe916f;p=rspamd.git [Minor] Add additional safe guard for nan values --- diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index f79de9b92..c59ae33dc 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -27,6 +27,7 @@ #include "cryptobox.h" #include "unix-std.h" #include "libmime/smtp_parsers.h" +#include /*** * @module rspamd_task @@ -3159,7 +3160,7 @@ lua_task_get_metric_score (lua_State *L) if ((metric_res = g_hash_table_lookup (task->results, metric_name)) != NULL) { lua_createtable (L, 2, 0); - lua_pushnumber (L, metric_res->score); + lua_pushnumber (L, isnan (metric_res->score) ? 0.0 : metric_res->score); rs = rspamd_task_get_required_score (task, metric_res); lua_rawseti (L, -2, 1); lua_pushnumber (L, rs);