From: Yehor Velykozhon -X (yvelykoz - SOFTSERVE INC at Cisco) Date: Tue, 2 Apr 2024 13:24:32 +0000 (+0000) Subject: Pull request #4267: framework: add workaround to support case from double to unsigned X-Git-Tag: 3.1.84.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf03e7d9bed080c6b5373b179501474b6fee0944;p=thirdparty%2Fsnort3.git Pull request #4267: framework: add workaround to support case from double to unsigned Merge in SNORT/snort3 from ~YVELYKOZ/snort3:fix_parser_on_arm to master Squashed commit of the following: commit 3a02dd2f969f3902c8d48885a8a9259614259d10 Author: Yehor Velykozhon Date: Mon Apr 1 17:31:24 2024 +0300 framework: add correct cast from double to unsigned Standard doesn't not guarantee the conversion of negative double to unsigned. Meanwhile, cast double to int and int to unsigned is defined by it. --- diff --git a/src/framework/parameter.cc b/src/framework/parameter.cc index 07606cb30..12a85ade2 100644 --- a/src/framework/parameter.cc +++ b/src/framework/parameter.cc @@ -200,7 +200,7 @@ static bool valid_int(Value& v, const char* r) { double d = v.get_real(); signed_values = (0.0 > d); - num = (uint64_t)d; + num = (uint64_t)(int64_t)d; break; }