diff options
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -303,11 +303,13 @@ static int processLineItem(redisReader *r) { d = INFINITY; /* Positive infinite. */ } else if (len == 4 && strcasecmp(buf,"-inf") == 0) { d = -INFINITY; /* Negative infinite. */ + } else if (len == 3 && strcasecmp(buf,"nan") == 0) { + d = NAN; /* nan. */ } else { d = strtod((char*)buf,&eptr); /* RESP3 only allows "inf", "-inf", and finite values, while - * strtod() allows other variations on infinity, NaN, - * etc. We explicity handle our two allowed infinite cases + * strtod() allows other variations on infinity, + * etc. We explicity handle our two allowed infinite cases and NaN * above, so strtod() should only result in finite values. */ if (buf[0] == '\0' || eptr != &buf[len] || !isfinite(d)) { __redisReaderSetError(r,REDIS_ERR_PROTOCOL, |