]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix undefined behavior in module tests
authorMarkus Theil <markus.theil@tu-ilmenau.de>
Wed, 8 Jan 2020 10:04:52 +0000 (11:04 +0100)
committerJouni Malinen <j@w1.fi>
Wed, 8 Jan 2020 12:56:55 +0000 (14:56 +0200)
Test: wpa_supplicant module tests
../src/utils/utils_module_tests.c:933:7: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
src/utils/utils_module_tests.c

index b09225de0533f6eabc4730c869dfe3e88e3a2547..f75d4065dd9ead245d0294a13da9c70e8b0ff83b 100644 (file)
@@ -930,7 +930,7 @@ static int const_time_tests(void)
                { 0, 0 },
                { 1, 0 },
                { 2, 0 },
-               { 1 << (sizeof(unsigned int) * 8 - 1), ~0 },
+               { 1U << (sizeof(unsigned int) * 8 - 1), ~0 },
                { ~0 - 1, ~0 },
                { ~0, ~0 }
        };
@@ -941,7 +941,7 @@ static int const_time_tests(void)
                { 0, ~0 },
                { 1, 0 },
                { 2, 0 },
-               { 1 << (sizeof(unsigned int) * 8 - 1), 0 },
+               { 1U << (sizeof(unsigned int) * 8 - 1), 0 },
                { ~0 - 1, 0 },
                { ~0, 0 }
        };