Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Unsafe casting of `int` to `uint` in `ThePredicter::withdraw`

Summary

Unsafe casting of int to uint in ThePredicter::withdraw

Vulnerability Details

In ThePredicter::withdraw the score variable which is an int8 is cast to an uint.

Impact

If the score variable is less than zero the resulting uint will be incorrect.

if (maxScore > 0 && score <= 0) { // if maxScore = 0 and score < 0
revert ThePredicter__NotEligibleForWithdraw();
}
uint256 shares = uint8(score); // if score = -1 then shares = 255

Tools Used

Manual Analysis

Recommendations

Add checks before casting.

Updates

Lead Judging Commences

NightHawK Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.