mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
ERC20: changes made to prevent subtraction overflow
Signed-off-by: Rajat Sharma <connecttorajat@outlook.com>
This commit is contained in:
parent
dc015eb3eb
commit
8c3534baa3
1 changed files with 2 additions and 2 deletions
|
|
@ -721,9 +721,9 @@ func sub(b int, q int) (int, error) {
|
|||
|
||||
// Check overflow
|
||||
var diff int
|
||||
diff = q - b
|
||||
diff = b - q
|
||||
|
||||
if (diff > q) == (b >= 0 && q >= 0) {
|
||||
if (diff > b) == (b >= 0 && q >= 0) {
|
||||
return 0, fmt.Errorf("Math: Subtraction overflow occurred %d - %d", b, q)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue