Skip to content

Commit

Permalink
Improve reentrancy heuristic (remove FP)
Browse files Browse the repository at this point in the history
  • Loading branch information
montyly committed Jan 29, 2019
1 parent 2ac861f commit 547f7aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions slither/detectors/reentrancy/reentrancy_benign.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def find_reentrancies(self):
for f in contract.functions_and_modifiers_not_inherited:
for node in f.nodes:
if node.context[self.KEY]['calls']:
if not any(n!=node for n in node.context[self.KEY]['calls']):
continue
read_then_written = []
for c in node.context[self.KEY]['calls']:
read_then_written += [v for v in node.context[self.KEY]['written']
Expand Down
2 changes: 2 additions & 0 deletions slither/detectors/reentrancy/reentrancy_eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def find_reentrancies(self):
for f in contract.functions_and_modifiers_not_inherited:
for node in f.nodes:
if node.context[self.KEY]['calls'] and node.context[self.KEY]['send_eth']:
if not any(n!=node for n in node.context[self.KEY]['send_eth']):
continue
read_then_written = []
for c in node.context[self.KEY]['calls']:
if c == node:
Expand Down

0 comments on commit 547f7aa

Please sign in to comment.