]> git.saurik.com Git - redis.git/commit
BITOP bug when called against non existing keys fixed.
authorantirez <antirez@gmail.com>
Thu, 31 May 2012 19:45:39 +0000 (21:45 +0200)
committerantirez <antirez@gmail.com>
Thu, 31 May 2012 19:51:52 +0000 (21:51 +0200)
commit8f0658cdd063b762ece37c8159a3cb1551526a7f
treec6e8de8fdffc58809ddafa879747464ec5114093
parent9a8d51add539e0b69fa4bcd6454e6a9dd8301763
BITOP bug when called against non existing keys fixed.

In the issue #529 an user reported a bug that can be triggered with the
following code:

flushdb
set a
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
bitop or x a b

The bug was introduced with the speed optimization in commit 8bbc076
that specializes every BITOP operation loop up to the minimum length of
the input strings.

However the computation of the minimum length contained an error when a
non existing key was present in the input, after a key that was non zero
length.

This commit fixes the bug and adds a regression test for it.
src/bitops.c
tests/unit/bitops.tcl