Unverified Commit c98a28a8 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix LREM count LONG_MIN overflow minor issue (#12465)

Limit the range of LREM count to -LONG_MAX ~ LONG_MAX.
Before the fix, passing -LONG_MAX would cause an overflow
and would effectively be the same as passing 0. (Because
this condition `toremove && removed == toremove `can never
be satisfied).

This is a minor fix as it shouldn't really affect users,
more like a cleanup.
parent 16988208
......@@ -1060,7 +1060,7 @@ void lremCommand(client *c) {
long toremove;
long removed = 0;
if ((getLongFromObjectOrReply(c, c->argv[2], &toremove, NULL) != C_OK))
if (getRangeLongFromObjectOrReply(c, c->argv[2], -LONG_MAX, LONG_MAX, &toremove, NULL) != C_OK)
return;
subject = lookupKeyWriteOrReply(c,c->argv[1],shared.czero);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment