diff options
author | Gabe Van Engel <gabe@schizoid.net> | 2022-01-23 20:26:22 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2022-02-09 12:29:46 -0800 |
commit | c22c46474ab0637ef76c98e4a7efbe3b9ae7652f (patch) | |
tree | 4cc709bbff8b7b1cfebb7975fec647c85f869c91 /assoc.c | |
parent | 186834a6d6c0302e2bdae00a608f3f16deb09cf7 (diff) | |
download | memcached-c22c46474ab0637ef76c98e4a7efbe3b9ae7652f.tar.gz |
Fix integer overflow in hashsize calculation.
Remove use of confusing ub4 type in hashsize calculation, which actually needs to be greater than 4 byte.
Remove unused ub4 and ub1 typedefs.
Diffstat (limited to 'assoc.c')
-rw-r--r-- | assoc.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -28,13 +28,10 @@ static pthread_cond_t maintenance_cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t maintenance_lock = PTHREAD_MUTEX_INITIALIZER; -typedef uint32_t ub4; /* unsigned 4-byte quantities */ -typedef unsigned char ub1; /* unsigned 1-byte quantities */ - /* how many powers of 2's worth of buckets we use */ unsigned int hashpower = HASHPOWER_DEFAULT; -#define hashsize(n) ((ub4)1<<(n)) +#define hashsize(n) ((uint64_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) /* Main hash table. This is where we look except during expansion. */ |