From d070abe44cdc63ece3533d06986629b5b5c21ca8 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 15 May 2011 15:33:01 +0200 Subject: [PATCH] Fix for a possible bug related to ZINTER/UNIONSTORE called with the same source set more than one time. --- src/t_zset.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/t_zset.c b/src/t_zset.c index 3e76ebd1..8b166209 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -1521,7 +1521,10 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) { score = src[0].weight * zval.score; for (j = 1; j < setnum; j++) { - if (zuiFind(&src[j],&zval,&value)) { + if (src[j].subject == src[0].subject) { + value = zval.score*src[j].weight; + zunionInterAggregate(&score,value,aggregate); + } else if (zuiFind(&src[j],&zval,&value)) { value *= src[j].weight; zunionInterAggregate(&score,value,aggregate); } else { -- 2.47.2