Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

There's no overflow/underflow check in Huff

Summary

There's no overflow/underflow check in Huff

Vulnerability Details

İn huff code if you feed the horse and then try to check if it's happy will result false cause anvil local blockchain starts currently from blocktimestamp 1 so the bool of happy horse will false cause of wrap-up
This test will revert with panic(0x11) Overflow/underflow error in solidity
however in huff it will revert as false as it never be feed.

function testFeedHorseSeveralTimesForHuff() public {
console2.log(block.timestamp);
vm.startPrank(user);
horseShit.feedHorse(0);
vm.stopPrank();
vm.roll(horseStore.HORSE_HAPPY_IF_FED_WITHIN()-1);
vm.warp(horseStore.HORSE_HAPPY_IF_FED_WITHIN()-1);
assertEq(horseStore.isHappyHorse(0),true);
}

This proves theres no overflow/underflow check in contract

Impact

no overflow/underflow check may lead unwanted calculation errors.

Tools Used

foundry

Recommendations

implement custom overflow/underflow logic in the contract

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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