mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
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:
parent
2f11c4410f
commit
20009ecd02
1 changed files with 1 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue