mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Merge pull request #3282 from wenduo/unstable
bitcount bug:return non-zero value when start > end (both negative)
This commit is contained in:
commit
001cadc854
@ -775,6 +775,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;
|
||||
|
Loading…
Reference in New Issue
Block a user