stake.link

stake.link
DeFiHardhatBridge
27,500 USDC
View results
Submission Details
Severity: low
Invalid

Unsafe `uint` to `int` conversion

Summary

Unsafe uint to int conversion

Vulnerability Details

The int type in Solidity uses the two's complement system, so it is possible to accidentally overflow a very large uint to an int, even if they share the same number of bytes (e.g. a uint256 number > type(uint128).max will overflow a int256 cast).
Consider using the SafeCast library to prevent any overflows.

Impact

Instances (7):

File: contracts/core/sdlPool/SDLPoolPrimary.sol
/// @audit uint256 -> int256
315: int256 diffTotalAmount = int256(lock.amount + lock.boostAmount) -
/// @audit uint256 -> int256
316: int256(locks[_lockId].amount + locks[_lockId].boostAmount);

315, 316

File: contracts/core/sdlPool/SDLPoolSecondary.sol
/// @audit uint256 -> int256
196: queuedRESDLSupplyChange -= int256(boostAmount);
/// @audit uint256 -> int256
235: queuedRESDLSupplyChange -= int256(_amount);
/// @audit uint256 -> int256
373: queuedRESDLSupplyChange += int256(lock.amount + lock.boostAmount);
/// @audit uint256 -> int256
438: int256(lockUpdate.lock.amount + lockUpdate.lock.boostAmount) -
/// @audit uint256 -> int256
439: int256(lock.amount + lock.boostAmount);

196, 235, 373, 438, 439

Tools Used

Recommendations

Updates

Lead Judging Commences

0kage Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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