aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-08-10 23:43:37 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-08-10 23:45:35 +0200
commit8543577b04ded6d979ffcc5a818930e4d74d0645 (patch)
tree7acb37ecf507de34de4d7260c6e943536f5fa8cf
parent2536c4f8584082a1ac4c5e0a2a6222e290d43983 (diff)
downloadglibc-8543577b04ded6d979ffcc5a818930e4d74d0645.zip
glibc-8543577b04ded6d979ffcc5a818930e4d74d0645.tar.gz
glibc-8543577b04ded6d979ffcc5a818930e4d74d0645.tar.bz2
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.
-rw-r--r--malloc/malloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index c135916..e08873c 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)
{