Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positives for actions on a reverting branch #61

Open
ritzdorf opened this issue Nov 27, 2018 · 4 comments
Open

False positives for actions on a reverting branch #61

ritzdorf opened this issue Nov 27, 2018 · 4 comments
Labels
Bug Something isn't working Some Day This issue may be worked on some day in the distant future

Comments

@ritzdorf
Copy link
Collaborator

Consider the following example:

contract Wallet {

  uint balance;
  function send(){
    if (balance > 0){
      msg.sender.call.value(balance)();
      balance = 0;
    }
    revert();
  }
}

Securify reports violations for multiple patterns even though they cannot take place. In my intuition, the patterns (probably most securify patterns) are lacking something saying that this action, e.g. the storage write in case of the DAO pattern, may be followed by a STOP or RETURN.

@ritzdorf ritzdorf added the Bug Something isn't working label Nov 27, 2018
@ptsankov
Copy link
Collaborator

Correct, all patterns assume that all instructions are reachable.

@ritzdorf
Copy link
Collaborator Author

@ptsankov thanks for the clarification. Which priority would you give this issue, given that most instructions will have some path to a non-reverting end of execution?

@ptsankov
Copy link
Collaborator

Close to zero, the assumption is reasonable, flagging dead code is fine, and to fix this precision issue we will need to integrate with the symbolic system which is pretty major.

@hiqua
Copy link
Contributor

hiqua commented Nov 28, 2018

For this kind of dead code (variable is read-only so the branching can solved statically, at compilation time), the improvement arguably belongs more to the compiler (optimizer) rather than Securify itself, so it could make more sense to solve it there directly.

@hiqua hiqua added the Some Day This issue may be worked on some day in the distant future label Nov 28, 2018
@hiqua hiqua removed their assignment Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Some Day This issue may be worked on some day in the distant future
Projects
None yet
Development

No branches or pull requests

3 participants