sherlock-audit / 2023-12-dodo-gsp-judging

6 stars 5 forks source link

bareli - totalshares can be 0 and function can be reverted. #135

Closed sherlock-admin2 closed 6 months ago

sherlock-admin2 commented 6 months ago

bareli

medium

totalshares can be 0 and function can be reverted.

Summary

totalshares can be 0 and function can be reverted.

Vulnerability Detail

baseAmount = baseBalance shareAmount / totalShares; quoteAmount = quoteBalance shareAmount / totalShares; Here totalshares can be 0 and function can be reverted.

Impact

Function can be reverted if totalshares can be 0.

Code Snippet

https://github.com/sherlock-audit/2023-12-dodo-gsp/blob/main/dodo-gassaving-pool/contracts/GasSavingPool/impl/GSPFunding.sol#L112

Tool used

Manual Review

Recommendation

use a require statement to verify the total shares.

nevillehuang commented 6 months ago

Invalid, if totalShares is zero, there will no shares to sell