This is a use-after-free (CWE-416). Any authenticated user who can write to a key that other clients are blocked on (for example with BLPOP, BLMPOP, BZPOPMIN or XREAD BLOCK) can trigger it on a server with client eviction enabled. The blocked clients do not have to belong to the attacker. The result is a reliable crash of the server process.
Servers with maxmemory-clients 0 (the default) are not affected.
After a command runs, processCommand() in src/server.c calls handleClientsBlockedOnKeys() to serve the clients blocked on keys the command made ready. unblockClientOnKey() in src/blocked.c points server.current_client at each blocked client and re-executes its command through processCommandAndResetClient(), and processCommand() starts by calling evictClients().
If the replies sent to blocked clients earlier in the same pass push client memory over maxmemory-clients, evictClients() can pick the client whose command made the key ready, which is still on the call stack. freeClient() in src/networking.c only defers freeing for server.current_client, so that client is freed immediately, and commandProcessed(), updateClientMemUsageAndBucket() and beforeNextClient() then run on the freed client. Among other things, resetClient() reads the argument vector pointers stored in the freed client and frees them.
You can mitigate this issue by setting maxmemory-clients to 0, which disables client eviction. If you do, make sure client-output-buffer-limit and maxmemory still bound client memory.
If client eviction is required, you can reduce exposure by using Valkey ACLs so that untrusted users cannot write to keys that other clients block on, and cannot run the blocking commands (BLPOP, BRPOP, BLMOVE, BRPOPLPUSH, BLMPOP, BZPOPMIN, BZPOPMAX, BZMPOP, and XREAD / XREADGROUP with BLOCK).
The defect was found and fixed by https://github.com/nadav-levanoni (issue #5422, fix #5435).