Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f45fa5d0
Commit
f45fa5d0
authored
May 30, 2016
by
wenduo
Committed by
antirez
Jun 15, 2016
Browse files
bitcount bug:return non-zero value when start > end (both negative)
parent
0cb86064
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bitops.c
View file @
f45fa5d0
...
@@ -775,6 +775,10 @@ void bitcountCommand(client *c) {
...
@@ -775,6 +775,10 @@ void bitcountCommand(client *c) {
/* Convert negative indexes */
/* Convert negative indexes */
if (start < 0) start = strlen+start;
if (start < 0) start = strlen+start;
if (end < 0) end = strlen+end;
if (end < 0) end = strlen+end;
if ((start < 0) && (end < 0) && (start > end)) {
addReply(c,shared.czero);
return;
}
if (start < 0) start = 0;
if (start < 0) start = 0;
if (end < 0) end = 0;
if (end < 0) end = 0;
if (end >= strlen) end = strlen-1;
if (end >= strlen) end = strlen-1;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment