ERC20: changes made to prevent subtraction overflow

Signed-off-by: Rajat Sharma <connecttorajat@outlook.com>
This commit is contained in:
Rajat Sharma 2022-06-18 00:03:09 +05:30 committed by Dave Enyeart
parent dc015eb3eb
commit 8c3534baa3

View file

@ -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)
}