Check Overflow
Extra caution should be exercised when performing addition, subtraction, or division operations. For instance, it's important to verify that an overflow hasn't occurred in cases where it could potentially happen.
Avoid:
Do : Check that the result is greater than one of the operands, return zero for example on overflow
You may also use the checkedAdd
, checkedSub
and checkedMul
operands, which cause the transaction to revert on overflow/underflow.
Last updated