mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-13 02:28:09 +00:00
Merge pull request #2120 from visitorckw/fix-shift-too-many-bits
Fix undefined behavior by casting to uint64_t before left shift
This commit is contained in:
@ -59,7 +59,7 @@ static inline unsigned int hash(uint64_t key) {
|
|||||||
bool hashmap_search_and_add(uint8_t type, uint64_t key) {
|
bool hashmap_search_and_add(uint8_t type, uint64_t key) {
|
||||||
|
|
||||||
if (unlikely(type >= 8)) return false;
|
if (unlikely(type >= 8)) return false;
|
||||||
uint64_t val = (key & 0xf8ffffffffffffff) + (type << 56);
|
uint64_t val = (key & 0xf8ffffffffffffff) + ((uint64_t)type << 56);
|
||||||
unsigned int index = hash(val);
|
unsigned int index = hash(val);
|
||||||
HashNode *node = _hashmap->table[index];
|
HashNode *node = _hashmap->table[index];
|
||||||
while (node) {
|
while (node) {
|
||||||
|
Reference in New Issue
Block a user