From: Samuel Thibault Date: Sun, 10 Aug 2025 21:43:37 +0000 (+0200) Subject: malloc: Fix checking for small negative values of tcache_key X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8543577b04ded6d979ffcc5a818930e4d74d0645;p=thirdparty%2Fglibc.git malloc: Fix checking for small negative values of tcache_key tcache_key is unsigned so we should turn it explicitly to signed before taking its absolute value. --- diff --git a/malloc/malloc.c b/malloc/malloc.c index c135916d32..e08873cad5 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -3108,7 +3108,7 @@ tcache_key_initialize (void) int minimum_bits = __WORDSIZE / 4; int maximum_bits = __WORDSIZE - minimum_bits; - while (labs (tcache_key) <= 0x1000000 + while (labs ((intptr_t) tcache_key) <= 0x1000000 || stdc_count_ones (tcache_key) < minimum_bits || stdc_count_ones (tcache_key) > maximum_bits) {