mirror of
https://github.com/redis/redis.git
synced 2026-05-28 04:02:46 -04:00
Fix cardinality type in sunionDiffGenericCommand to avoid truncation
The cardinality variable was declared as int while the limit parameter is long. The assignment cardinality = limit in the early-termination path could silently truncate for LIMIT values exceeding INT_MAX. Change cardinality from int to long to match limit. Kept as signed (unlike sinterGenericCommand's unsigned long) because the DIFF path decrements cardinality.
This commit is contained in:
parent
3c3d49f3b2
commit
4d6fd8d7cd
1 changed files with 2 additions and 2 deletions
|
|
@ -1645,8 +1645,8 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum,
|
|||
size_t len = 0;
|
||||
int64_t llval = 0;
|
||||
int encoding;
|
||||
int j, cardinality = 0;
|
||||
int diff_algo = 1;
|
||||
int j, diff_algo = 1;
|
||||
long cardinality = 0;
|
||||
int sameset = 0;
|
||||
|
||||
for (j = 0; j < setnum; j++) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue