]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: Fix checking for small negative values of tcache_key master
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 10 Aug 2025 21:43:37 +0000 (23:43 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 10 Aug 2025 21:45:35 +0000 (23:45 +0200)
tcache_key is unsigned so we should turn it explicitly to signed before
taking its absolute value.

malloc/malloc.c

index c135916d3204d367b50d1a15a70443c23334d0ce..e08873cad50ee9b05bda1eb3b50cef954ff7685a 100644 (file)
@@ -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)
     {