From 60b667d2b8c024eb654818acf9b357b67ee6902e Mon Sep 17 00:00:00 2001 From: Josselin Date: Mon, 16 Mar 2020 16:48:16 +0100 Subject: [PATCH] Improve uninitialized-state: remove FPs due to storage variables --- .../detectors/variables/uninitialized_state_variables.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/slither/detectors/variables/uninitialized_state_variables.py b/slither/detectors/variables/uninitialized_state_variables.py index 255709784..a9690b231 100644 --- a/slither/detectors/variables/uninitialized_state_variables.py +++ b/slither/detectors/variables/uninitialized_state_variables.py @@ -11,6 +11,7 @@ from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.slithir.operations import InternalCall, LibraryCall +from slither.slithir.variables import ReferenceVariable class UninitializedStateVarsDetection(AbstractDetector): @@ -56,7 +57,12 @@ Initialize all the variables. If a variable is meant to be initialized to zero, if ir.function: for param in ir.function.parameters: if param.location == 'storage': - ret.append(ir.arguments[idx]) + # If its a storage variable, add either the variable + # Or the variable it points to if its a reference + if isinstance(ir.arguments[idx], ReferenceVariable): + ret.append(ir.arguments[idx].points_to_origin) + else: + ret.append(ir.arguments[idx]) idx = idx + 1 return ret