code-423n4 / 2022-02-concur-findings

2 stars 0 forks source link

You should use safe casts here #279

Closed CloudEllie closed 2 years ago

CloudEllie commented 2 years ago

Judge @GalloDaSballo has assessed the 6th item in QA Report #254 as Medium risk. The relevant finding follows:

You should use safe casts here:

  deposits[_pid][msg.sender].amount += uint192(_amount);
  deposits[_pid][msg.sender].amount -= uint192(_amount);
  amount : uint192(_amount)

Otherwise, if token amounts are exceeding these limits (e.g. rebasing tokens) the accounted and transferred amounts will differ. For instance, in function deposit it will add less to the user's balance but charge the full amount:

  deposits[_pid][msg.sender].amount += uint192(_amount);
  ...
  lpToken.safeTransferFrom(msg.sender, address(this), _amount);
CloudEllie commented 2 years ago

Duplicate of #194