mirror of
https://github.com/redis/redis.git
synced 2026-04-21 03:01:35 -04:00
bitcount bug:return non-zero value when start > end (both negative)
This commit is contained in:
@@ -768,6 +768,10 @@ void bitcountCommand(client *c) {
|
||||
/* Convert negative indexes */
|
||||
if (start < 0) start = strlen+start;
|
||||
if (end < 0) end = strlen+end;
|
||||
if ((start < 0) && (end < 0) && (start > end)) {
|
||||
addReply(c,shared.czero);
|
||||
return;
|
||||
}
|
||||
if (start < 0) start = 0;
|
||||
if (end < 0) end = 0;
|
||||
if (end >= strlen) end = strlen-1;
|
||||
|
||||
Reference in New Issue
Block a user