mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Check if stroll return value was clamped
This commit is contained in:
parent
aaada3f962
commit
87c74dfaa8
@ -375,6 +375,7 @@ int getLongLongFromObject(robj *o, long long *target) {
|
|||||||
redisAssert(o->type == REDIS_STRING);
|
redisAssert(o->type == REDIS_STRING);
|
||||||
if (o->encoding == REDIS_ENCODING_RAW) {
|
if (o->encoding == REDIS_ENCODING_RAW) {
|
||||||
value = strtoll(o->ptr, &eptr, 10);
|
value = strtoll(o->ptr, &eptr, 10);
|
||||||
|
if (errno == ERANGE) return REDIS_ERR;
|
||||||
if (eptr[0] != '\0') return REDIS_ERR;
|
if (eptr[0] != '\0') return REDIS_ERR;
|
||||||
} else if (o->encoding == REDIS_ENCODING_INT) {
|
} else if (o->encoding == REDIS_ENCODING_INT) {
|
||||||
value = (long)o->ptr;
|
value = (long)o->ptr;
|
||||||
|
@ -45,6 +45,12 @@ start_server {
|
|||||||
assert_encoding hashtable myset
|
assert_encoding hashtable myset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "SADD an integer larger than 64 bits" {
|
||||||
|
create_set myset {213244124402402314402033402}
|
||||||
|
assert_encoding hashtable myset
|
||||||
|
assert_equal 1 [r sismember myset 213244124402402314402033402]
|
||||||
|
}
|
||||||
|
|
||||||
test "SADD overflows the maximum allowed integers in an intset" {
|
test "SADD overflows the maximum allowed integers in an intset" {
|
||||||
r del myset
|
r del myset
|
||||||
for {set i 0} {$i < 512} {incr i} { r sadd myset $i }
|
for {set i 0} {$i < 512} {incr i} { r sadd myset $i }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user