diff --git a/src/bitops.c b/src/bitops.c index d309b7afa..00192b92b 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -197,6 +197,7 @@ void bitopCommand(redisClient *c) { objects[j] = NULL; src[j] = NULL; len[j] = 0; + minlen = 0; continue; } /* Return an error if one of the keys is not a string. */ diff --git a/tests/unit/bitops.tcl b/tests/unit/bitops.tcl index c8f58ef1e..0e3403bfe 100644 --- a/tests/unit/bitops.tcl +++ b/tests/unit/bitops.tcl @@ -160,4 +160,10 @@ start_server {tags {"bitops"}} { catch {r bitop xor dest a b c d} e set e } {*ERR*} + + test {BITOP with empty string after non empty string (issue #529)} { + r flushdb + r 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" + r bitop or x a b + } {32} }