Closed code423n4 closed 2 years ago
pauliax
totalWeights might be zero and this will cause division by 0 runtime error. function _computeShareCount divides by _totalWeights:
return (_amount * _weight) / _totalWeights;
Admin can accidentaly set totalWeights to 0 in function setRoyaltiesWeight when totalWeights = royaltiesWeight and _weight = 0.
Consider algorithmitcally enforcing totalWeights > 0 or handle this special case in function _computeShareCount.
duplicate #43
Handle
pauliax
Vulnerability details
Impact
totalWeights might be zero and this will cause division by 0 runtime error. function _computeShareCount divides by _totalWeights:
Admin can accidentaly set totalWeights to 0 in function setRoyaltiesWeight when totalWeights = royaltiesWeight and _weight = 0.
Recommended Mitigation Steps
Consider algorithmitcally enforcing totalWeights > 0 or handle this special case in function _computeShareCount.