Redis and Valkey are vulnerable to a heap-based buffer overflow in the HyperLogLog functionality. An authenticated attacker can exploit this vulnerability by sending a specially crafted string, potentially leading to remote code execution (RCE). The root cause is an integer overflow in the `hllMerge()` function when processing sparse HyperLogLog data, leading to an out-of-bounds write. A Proof-of-Concept (PoC) exploit is available. The vulnerability affects versions 2.8 and later of Redis, up to and including 8.0.3, 7.4.5, 7.2.10, and 6.2.19. Valkey versions up to 8.1.3 and 8.0.4 are also impacted.