Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BITCOUNT: fix segmentation fault.

remove unsafe and unnecessary cast.
until now, this cast may lead segmentation fault when end > UINT_MAX

# example
setbit foo 0 1
bitcount  0 4294967295
=> ok
bitcount  0 4294967296
=> cause segmentation fault.
  • Loading branch information...
commit 73e21d7dc4cae87fbfae2bd574d68c14086d6518 1 parent a2db8e4
@trapezoid authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/bitops.c
View
2  src/bitops.c
@@ -357,7 +357,7 @@ void bitcountCommand(redisClient *c) {
if (end < 0) end = strlen+end;
if (start < 0) start = 0;
if (end < 0) end = 0;
- if ((unsigned)end >= strlen) end = strlen-1;
+ if (end >= strlen) end = strlen-1;
} else if (c->argc == 2) {
/* The whole string. */
start = 0;

0 comments on commit 73e21d7

Please sign in to comment.
Something went wrong with that request. Please try again.