NFTBridge
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

The unsafe casting of the recovered amount from `uint256` to `uint8`

Vulnerability Details

The unsafe casting of the recovered amount from uint256 to uint8 which may result in a loss of precision or even an overflow.

//Found in: "src/sn/Cairo.so"
450: for (uint256 i = 0; i < length; ++i) {
451 uint256 asciiValue = (value >> (8 * (length - 1 - i))) & 0xFF;
452 byteString[i] = bytes1(uint8(asciiValue));
453: }

Impact

loss of precision or even an overflow.

Tools Used

Aderyn

Recommendations

asciiValue should be of type uint256. Alternatively, use OpenZeppelin’s SafeCast library when casting from uint256 to uint8.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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