At line 103 in the burnAll function of RebasingGToken, applyFactor(burnAmount, factor(), false) is used to calculate the burned amount. However, the result of factor() could return 0 and cause a division-by-zero error in the funtion applyFactor (note that the 3rd parameter is false).
Handle
shw
Vulnerability details
Impact
At line 103 in the
burnAll
function ofRebasingGToken
,applyFactor(burnAmount, factor(), false)
is used to calculate the burnedamount
. However, the result offactor()
could return 0 and cause a division-by-zero error in the funtionapplyFactor
(note that the 3rd parameter isfalse
).Proof of Concept
Referenced code: RebasingGToken.sol#L103
Recommended Mitigation Steps
Add checks to handle cases where
factor()
returns 0, similar to those in thetotalSupply
andbalanceOf
functions.