about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2024-06-12 08:23:14 +0200
committerGitHub <noreply@github.com>2024-06-12 08:23:14 +0200
commite68d57feecd25a9698bc4df0c9b38274a7d4ebbe (patch)
tree15f32ee3871fc71b7cefb72e9d86746d125f6e16 /src
parent75c3fa91dcf2998a2f103d76fc4e0339f6263f5e (diff)
parent0c9d8e5929c819c0e4de6930065b383843ba8d58 (diff)
downloadafl++-e68d57feecd25a9698bc4df0c9b38274a7d4ebbe.tar.gz
Merge pull request #2120 from visitorckw/fix-shift-too-many-bits
Fix undefined behavior by casting to uint64_t before left shift
Diffstat (limited to 'src')
-rw-r--r--src/hashmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hashmap.c b/src/hashmap.c
index a0a9283c..5834802f 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -59,7 +59,7 @@ static inline unsigned int hash(uint64_t key) {
 bool hashmap_search_and_add(uint8_t type, uint64_t key) {
 
   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);
   HashNode    *node = _hashmap->table[index];
   while (node) {