The GitHub Actions job "CI" on kvrocks.git has succeeded.
Run started by GitHub user enjoy-binbin (triggered by enjoy-binbin).

Head commit for run:
423417e09195af8a973fa5177689e50955360ae8 / Binbin <binloveplay1...@qq.com>
Fix LPOS rank passing LLONG_MIN overflow issue

There is a minor overflow issue in RANK negation, passing LLONG_MIN
will overflow and is effectively be the same as passing -1.

This is the example before the fix:
```
127.0.0.1:6666> flushall
OK
127.0.0.1:6666> lpos mylist foo rank -9223372036854775808
(nil)
127.0.0.1:6666> lpush mylist foo foo foo foo foo
(integer) 5

127.0.0.1:6666> lpos mylist foo rank -1
(integer) 4
127.0.0.1:6666> lpos mylist foo rank -5
(integer) 0
127.0.0.1:6666> lpos mylist foo rank -6
(nil)
127.0.0.1:6666> lpos mylist foo rank -9223372036854775807
(nil)

-- this should return nil but it returned the last one because the overflow 
rank became -1
127.0.0.1:6666> lpos mylist foo rank -9223372036854775808
(integer) 4
```

Now we limit RANK to not be LLONG_MIN and will throw an error directly
(this is the behavior of Redis 7.2, but with different error words):
```
127.0.0.1:6666> lpos mylist foo rank -9223372036854775808
(error) ERR rank would overflow

127.0.0.1:6379> lpos mylist foo rank -9223372036854775808
(error) ERR value is out of range, value must between -9223372036854775807 and 
9223372036854775807
```

Report URL: https://github.com/apache/kvrocks/actions/runs/5923335624

With regards,
GitHub Actions via GitBox

Reply via email to