diff options
author | chendianqiang <c.d_q@163.com> | 2022-08-28 16:33:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-28 11:33:41 +0300 |
commit | bc7fe41e5857a0854d524e2a63a028e9394d2a5c (patch) | |
tree | 1191701153059b83e4f5216a655faaf236867aea /src/t_hash.c | |
parent | a7da7473cbd791589b943f38dcb855404a872928 (diff) | |
download | redis-bc7fe41e5857a0854d524e2a63a028e9394d2a5c.tar.gz |
fix hincrbyfloat not to create a key if the new value is invalid (#11149)
Check the validity of the value before performing the create operation,
prevents new data from being generated even if the request fails to execute.
Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: chendianqiang <chendianqiang@meituan.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Diffstat (limited to 'src/t_hash.c')
-rw-r--r-- | src/t_hash.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/t_hash.c b/src/t_hash.c index 63447a4c1..a2af438ae 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -666,6 +666,10 @@ void hincrbyfloatCommand(client *c) { unsigned int vlen; if (getLongDoubleFromObjectOrReply(c,c->argv[3],&incr,NULL) != C_OK) return; + if (isnan(incr) || isinf(incr)) { + addReplyError(c,"value is NaN or Infinity"); + return; + } if ((o = hashTypeLookupWriteOrCreate(c,c->argv[1])) == NULL) return; if (hashTypeGetValue(o,c->argv[2]->ptr,&vstr,&vlen,&ll) == C_OK) { if (vstr) { |