mirror of
https://github.com/fluencelabs/redis
synced 2025-06-24 06:21:32 +00:00
BITCOUNT: fix segmentation fault.
remove unsafe and unnecessary cast. until now, this cast may lead segmentation fault when end > UINT_MAX setbit foo 0 1 bitcount 0 4294967295 => ok bitcount 0 4294967296 => cause segmentation fault. Note by @antirez: the commit was modified a bit to also change the string length type to long, since it's guaranteed to be at max 512 MB in size, so we can work with the same type across all the code path. A regression test was also added.
This commit is contained in:
@ -73,6 +73,12 @@ start_server {tags {"bitops"}} {
|
||||
set e
|
||||
} {ERR*syntax*}
|
||||
|
||||
test {BITCOUNT regression test for github issue #582} {
|
||||
r del str
|
||||
r setbit foo 0 1
|
||||
r bitcount foo 0 4294967296
|
||||
} {1}
|
||||
|
||||
test {BITOP NOT (empty string)} {
|
||||
r set s ""
|
||||
r bitop not dest s
|
||||
|
Reference in New Issue
Block a user