Skip to content

Commit

Permalink
Merge pull request #4690 from obache/fix-pointer-int-cast
Browse files Browse the repository at this point in the history
prevent to cast from pointer to uint64 directly
  • Loading branch information
elliefm committed Oct 19, 2023
2 parents dbfd0cc + 02f6570 commit 2ab6a5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions imap/search_expr.c
Expand Up @@ -792,7 +792,7 @@ static int maxcost(const search_expr_t *e, hashu64_table *costcache)
if (!e) return 0;

if (costcache) {
intptr_t cost = (intptr_t) hashu64_lookup((uint64_t) e, costcache);
intptr_t cost = (intptr_t) hashu64_lookup((uint64_t)(uintptr_t) e, costcache);
assert(cost > INT_MIN && cost < INT_MAX);
if (cost) return cost > 0 ? cost : 0;
}
Expand All @@ -805,7 +805,7 @@ static int maxcost(const search_expr_t *e, hashu64_table *costcache)
}

if (costcache) {
hashu64_insert((uint64_t) e, (void*)((intptr_t)(cost ? cost : -1)), costcache);
hashu64_insert((uint64_t)(uintptr_t) e, (void*)((intptr_t)(cost ? cost : -1)), costcache);
}
return cost;
}
Expand Down

0 comments on commit 2ab6a5f

Please sign in to comment.