mirror of
https://github.com/fluencelabs/redis
synced 2025-06-22 13:31:32 +00:00
Change getDoubleFromObject to fail on NaN.
Return an error when the resulting value is not a number (NaN). Fix ZUNIONSTORE/ZINTERSTORE to clean up when a weight argument is not a double value.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "redis.h"
|
||||
#include <pthread.h>
|
||||
#include <math.h>
|
||||
|
||||
robj *createObject(int type, void *ptr) {
|
||||
robj *o;
|
||||
@ -319,7 +320,7 @@ int getDoubleFromObject(robj *o, double *target) {
|
||||
redisAssert(o->type == REDIS_STRING);
|
||||
if (o->encoding == REDIS_ENCODING_RAW) {
|
||||
value = strtod(o->ptr, &eptr);
|
||||
if (eptr[0] != '\0') return REDIS_ERR;
|
||||
if (eptr[0] != '\0' || isnan(value)) return REDIS_ERR;
|
||||
} else if (o->encoding == REDIS_ENCODING_INT) {
|
||||
value = (long)o->ptr;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user