Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  src/bitops.c
2  src/bitops.c
@@ -357,7 +357,7 @@ void bitcountCommand(redisClient *c) {
357 357 if (end < 0) end = strlen+end;
358 358 if (start < 0) start = 0;
359 359 if (end < 0) end = 0;
360   - if ((unsigned)end >= strlen) end = strlen-1;
  360 + if (end >= strlen) end = strlen-1;
361 361 } else if (c->argc == 2) {
362 362 /* The whole string. */
363 363 start = 0;

0 comments on commit 73e21d7

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