Sablier

Sablier
DeFiFoundry
53,440 USDC
View results
Submission Details
Severity: low
Invalid

wrong calculation of "width" in card.

Summary

wrong calculation of width in the card as width = 208; // 3 * 20 (margins) + 8 * 13 (charWidth) + 44 (diameter).but the calculation will lead to 188.

Vulnerability Details

function card(
CardType cardType,
string memory content,
string memory circle
)
internal
pure
returns (uint256 width, string memory card_)
{
string memory caption = stringifyCardType(cardType);

    // The progress card can have a fixed width because the content is never longer than the caption. The former
    // has 6 characters (at most, e.g. "42.09%"), whereas the latter has 8 characters ("Progress").
    if (cardType == CardType.PROGRESS) {
        // The progress can be 0%, in which case the circle is not rendered.
        if (circle.equal("")) {
            width = 144; // 2 * 20 (margins) + 8 * 13 (charWidth)
        } else {
  @>>          width = 208; // 3 * 20 (margins) + 8 * 13 (charWidth) + 44 (diameter)
        }
    }

Impact

wrong calculation of width.

Tools Used

Recommendations

width = 188; // 3 * 20 (margins) + 8 * 13 (charWidth) + 44 (diameter)

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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