From 547f7aadaadbaefba6f6f9934e2d75fe34d9345e Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 29 Jan 2019 11:00:05 +0000 Subject: [PATCH] Improve reentrancy heuristic (remove FP) --- slither/detectors/reentrancy/reentrancy_benign.py | 2 ++ slither/detectors/reentrancy/reentrancy_eth.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/slither/detectors/reentrancy/reentrancy_benign.py b/slither/detectors/reentrancy/reentrancy_benign.py index 26570f02c3..f8834d1f03 100644 --- a/slither/detectors/reentrancy/reentrancy_benign.py +++ b/slither/detectors/reentrancy/reentrancy_benign.py @@ -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'] diff --git a/slither/detectors/reentrancy/reentrancy_eth.py b/slither/detectors/reentrancy/reentrancy_eth.py index f77b80c467..4e2e648bc5 100644 --- a/slither/detectors/reentrancy/reentrancy_eth.py +++ b/slither/detectors/reentrancy/reentrancy_eth.py @@ -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: