Improve reentrancy heuristic (remove FP)

pull/162/head
Josselin 6 years ago
parent 2ac861f5e0
commit 547f7aadaa
  1. 2
      slither/detectors/reentrancy/reentrancy_benign.py
  2. 2
      slither/detectors/reentrancy/reentrancy_eth.py

@ -30,6 +30,8 @@ class ReentrancyBenign(Reentrancy):
for f in contract.functions_and_modifiers_not_inherited: for f in contract.functions_and_modifiers_not_inherited:
for node in f.nodes: for node in f.nodes:
if node.context[self.KEY]['calls']: if node.context[self.KEY]['calls']:
if not any(n!=node for n in node.context[self.KEY]['calls']):
continue
read_then_written = [] read_then_written = []
for c in node.context[self.KEY]['calls']: for c in node.context[self.KEY]['calls']:
read_then_written += [v for v in node.context[self.KEY]['written'] read_then_written += [v for v in node.context[self.KEY]['written']

@ -31,6 +31,8 @@ class ReentrancyEth(Reentrancy):
for f in contract.functions_and_modifiers_not_inherited: for f in contract.functions_and_modifiers_not_inherited:
for node in f.nodes: for node in f.nodes:
if node.context[self.KEY]['calls'] and node.context[self.KEY]['send_eth']: 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 = [] read_then_written = []
for c in node.context[self.KEY]['calls']: for c in node.context[self.KEY]['calls']:
if c == node: if c == node:

Loading…
Cancel
Save