I found an example of underflow bug at: Catching Vulnerable Smart Contracts Once and for All

contract UnderflowAttack {
 function withdraw (uint amount) public {
   require(balances[msg.sender] - amount > 0);
   balances[msg.sender] -= amount; //Underflow

I feel the above contract also exhibits signedness bug. Can somebody please provide me a more specific example of a signedness bug in smart contract?

  • If an underflow happens at balances[msg.sender] -= amount, that same underflow also happens at require(balances[msg.sender] - amount > 0) because the exact same subtraction is being performed. – Jesse Busman Jun 12 '19 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.