diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-27 18:50:33 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-28 02:52:03 +0000 |
commit | d4ef22db8f21f7ed5ebf16bfcf335e32102bfe8d (patch) | |
tree | 34a0146354521a10173fd71fb3ac9b6d53ae7709 | |
parent | ac69a67112a776f857614e7a11ffd7012d7e80e8 (diff) |
Make sure CAPACITY() doesn't shift the 1 out of range.
Make the 1 we shift left the size of a size_t, so it'll only go out of
range if the result couldn't possibly fit in a size_t. (That should
also make the object of the shift unsigned, which may squelch some other
complaints.)
Not that the map is *likely* to be bigger than 4GB, but it should
squelch some complaints from Visual Studio Code Analysis.
Change-Id: I489bfe6b1d9d4329c267936d9106dbba4388c492
Reviewed-on: https://code.wireshark.org/review/26163
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/wmem/wmem_map.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/wmem/wmem_map.c b/epan/wmem/wmem_map.c index 7568e9377e..8164f2b47c 100644 --- a/epan/wmem/wmem_map.c +++ b/epan/wmem/wmem_map.c @@ -68,7 +68,7 @@ struct _wmem_map_t { /* Macro for calculating the real capacity of the map by using a left-shift to * do the 2^x operation. */ -#define CAPACITY(MAP) ((size_t)(1 << (MAP)->capacity)) +#define CAPACITY(MAP) (((size_t)1) << (MAP)->capacity) /* Efficient universal integer hashing: * https://en.wikipedia.org/wiki/Universal_hashing#Avoiding_modular_arithmetic |