]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Pull request #4267: framework: add workaround to support case from double to unsigned
authorYehor Velykozhon -X (yvelykoz - SOFTSERVE INC at Cisco) <yvelykoz@cisco.com>
Tue, 2 Apr 2024 13:24:32 +0000 (13:24 +0000)
committerOleksii Shumeiko -X (oshumeik - SOFTSERVE INC at Cisco) <oshumeik@cisco.com>
Tue, 2 Apr 2024 13:24:32 +0000 (13:24 +0000)
Merge in SNORT/snort3 from ~YVELYKOZ/snort3:fix_parser_on_arm to master

Squashed commit of the following:

commit 3a02dd2f969f3902c8d48885a8a9259614259d10
Author: Yehor Velykozhon <yvelykoz@cisco.com>
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.

src/framework/parameter.cc

index 07606cb30b0ea76d86cd3a5dcc131d394764a9ea..12a85ade2302a2fdda87d6556dec73c1276905c5 100644 (file)
@@ -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;
     }