Prevent dupplicate results for unini local var detector

pull/113/head
Josselin 6 years ago
parent f4ecee03ee
commit 3fb066d7fb
  1. 6
      slither/detectors/variables/uninitialized_local_variables.py

@ -74,15 +74,15 @@ class UninitializedLocalVars(AbstractDetector):
for contract in self.slither.contracts: for contract in self.slither.contracts:
for function in contract.functions: for function in contract.functions:
if function.is_implemented: if function.is_implemented and function.contract == contract:
if function.contains_assembly: if function.contains_assembly:
continue continue
# dont consider storage variable, as they are detected by another detector # 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] 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 function.entry_point.context[self.key] = uninitialized_local_variables
self._detect_uninitialized(function, function.entry_point, []) self._detect_uninitialized(function, function.entry_point, [])
all_results = list(set(self.results))
for(function, uninitialized_local_variable) in self.results: for(function, uninitialized_local_variable) in all_results:
var_name = uninitialized_local_variable.name var_name = uninitialized_local_variable.name
info = "{} in {}.{} ({}) is a local variable never initialiazed\n" info = "{} in {}.{} ({}) is a local variable never initialiazed\n"

Loading…
Cancel
Save