From e9c9476ea4e90a83ee696e9c12fddb8a9107a932 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 29 Jan 2019 10:31:30 +0000 Subject: [PATCH] Improve reentrancy benign --- slither/detectors/reentrancy/reentrancy_benign.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slither/detectors/reentrancy/reentrancy_benign.py b/slither/detectors/reentrancy/reentrancy_benign.py index 0bed8b379..26570f02c 100644 --- a/slither/detectors/reentrancy/reentrancy_benign.py +++ b/slither/detectors/reentrancy/reentrancy_benign.py @@ -30,8 +30,12 @@ class ReentrancyBenign(Reentrancy): for f in contract.functions_and_modifiers_not_inherited: for node in f.nodes: if node.context[self.KEY]['calls']: + read_then_written = [] + for c in node.context[self.KEY]['calls']: + read_then_written += [v for v in node.context[self.KEY]['written'] + if v in node.context[self.KEY]['read_prior_calls'][c]] not_read_then_written = [(v, node) for v in node.context[self.KEY]['written'] - if v not in node.context[self.KEY]['read']] + if v not in read_then_written] if not_read_then_written: # calls are ordered