Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
256356ff
Commit
256356ff
authored
Dec 23, 2011
by
antirez
Browse files
Prevent NaN scores in sorted sets resulting from calls to ZUNIONSTORE and ZINTERSTORE.
parent
d334281c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_zset.c
View file @
256356ff
...
@@ -1545,6 +1545,8 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
...
@@ -1545,6 +1545,8 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
double
score
,
value
;
double
score
,
value
;
score
=
src
[
0
].
weight
*
zval
.
score
;
score
=
src
[
0
].
weight
*
zval
.
score
;
if
(
isnan
(
score
))
score
=
0
;
for
(
j
=
1
;
j
<
setnum
;
j
++
)
{
for
(
j
=
1
;
j
<
setnum
;
j
++
)
{
/* It is not safe to access the zset we are
/* It is not safe to access the zset we are
* iterating, so explicitly check for equal object. */
* iterating, so explicitly check for equal object. */
...
@@ -1587,6 +1589,7 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
...
@@ -1587,6 +1589,7 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
/* Initialize score */
/* Initialize score */
score
=
src
[
i
].
weight
*
zval
.
score
;
score
=
src
[
i
].
weight
*
zval
.
score
;
if
(
isnan
(
score
))
score
=
0
;
/* Because the inputs are sorted by size, it's only possible
/* Because the inputs are sorted by size, it's only possible
* for sets at larger indices to hold this element. */
* for sets at larger indices to hold this element. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment