From: Markus Theil Date: Wed, 8 Jan 2020 10:04:52 +0000 (+0100) Subject: tests: Fix undefined behavior in module tests X-Git-Tag: hostap_2_10~1970 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7b2fe99eaf1abb89c1a0b11a8d760718913f655;p=thirdparty%2Fhostap.git tests: Fix undefined behavior in module tests 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 --- diff --git a/src/utils/utils_module_tests.c b/src/utils/utils_module_tests.c index b09225de0..f75d4065d 100644 --- a/src/utils/utils_module_tests.c +++ b/src/utils/utils_module_tests.c @@ -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 } };