Update token_contract.go, modify the overflow judgment condition for function add()

Signed-off-by: yjwxfq <112159687+yjwxfq@users.noreply.github.com>
This commit is contained in:
yjwxfq 2023-06-01 14:17:22 +08:00 committed by Dave Enyeart
parent 2f11c4410f
commit 20009ecd02

View file

@ -695,7 +695,7 @@ func add(b int, q int) (int, error) {
var sum int
sum = q + b
if (sum < q) == (b >= 0 && q >= 0) {
if (sum < q || sum < b) == (b >= 0 && q >= 0) {
return 0, fmt.Errorf("Math: addition overflow occurred %d + %d", b, q)
}