From 3fb066d7fb811da63c649cf06720962b6c25d3fe Mon Sep 17 00:00:00 2001 From: Josselin Date: Fri, 14 Dec 2018 15:16:03 -0500 Subject: [PATCH] Prevent dupplicate results for unini local var detector --- .../detectors/variables/uninitialized_local_variables.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slither/detectors/variables/uninitialized_local_variables.py b/slither/detectors/variables/uninitialized_local_variables.py index e932720af..2aa08e1ab 100644 --- a/slither/detectors/variables/uninitialized_local_variables.py +++ b/slither/detectors/variables/uninitialized_local_variables.py @@ -74,15 +74,15 @@ class UninitializedLocalVars(AbstractDetector): for contract in self.slither.contracts: for function in contract.functions: - if function.is_implemented: + if function.is_implemented and function.contract == contract: if function.contains_assembly: continue # dont consider storage variable, as they are detected by another detector uninitialized_local_variables = [v for v in function.local_variables if not v.is_storage and v.uninitialized] function.entry_point.context[self.key] = uninitialized_local_variables self._detect_uninitialized(function, function.entry_point, []) - - for(function, uninitialized_local_variable) in self.results: + all_results = list(set(self.results)) + for(function, uninitialized_local_variable) in all_results: var_name = uninitialized_local_variable.name info = "{} in {}.{} ({}) is a local variable never initialiazed\n"