From 77cd643360111b56328b4c15b1e68373c6fa9953 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 5 Feb 2019 11:12:44 -0500 Subject: [PATCH] Remove reentrancy FP due to call to view/pure functions or state variable getters (fix #126) --- slither/detectors/reentrancy/reentrancy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slither/detectors/reentrancy/reentrancy.py b/slither/detectors/reentrancy/reentrancy.py index 3b9a57391..d1e3db45d 100644 --- a/slither/detectors/reentrancy/reentrancy.py +++ b/slither/detectors/reentrancy/reentrancy.py @@ -13,6 +13,7 @@ from slither.detectors.abstract_detector import (AbstractDetector, from slither.slithir.operations import (HighLevelCall, LowLevelCall, LibraryCall, Send, Transfer) +from slither.core.variables.variable import Variable def union_dict(d1, d2): d3 = {k: d1.get(k, set()) | d2.get(k, set()) for k in set(list(d1.keys()) + list(d2.keys()))} @@ -49,6 +50,10 @@ class Reentrancy(AbstractDetector): if isinstance(ir, LowLevelCall): return True if isinstance(ir, HighLevelCall) and not isinstance(ir, LibraryCall): + if isinstance(ir.function, Function) and (ir.function.view or ir.function.pure): + continue + if isinstance(ir.function, Variable): + continue return True return False