pull/1816/head
webthethird 2 years ago
parent 178960f655
commit 3bcefac1c8
  1. 12
      slither/utils/upgradeability.py

@ -233,17 +233,14 @@ def tainted_external_contracts(funcs: List[Function]) -> List[TaintedExternalCon
if ( if (
isinstance(target, Function) isinstance(target, Function)
and target not in funcs and target not in funcs
and target and target not in (f for f in tainted_contracts[contract.name].tainted_functions)
not in (f for f in tainted_contracts[contract.name].tainted_functions)
and not (target.is_constructor or target.is_fallback or target.is_receive) and not (target.is_constructor or target.is_fallback or target.is_receive)
): ):
# Found a high-level call to a new tainted function # Found a high-level call to a new tainted function
tainted_contracts[contract.name].add_tainted_function(target) tainted_contracts[contract.name].add_tainted_function(target)
for var in target.all_state_variables_written(): for var in target.all_state_variables_written():
# Consider as tainted all variables written by the tainted function # Consider as tainted all variables written by the tainted function
if var not in ( if var not in (v for v in tainted_contracts[contract.name].tainted_variables):
v for v in tainted_contracts[contract.name].tainted_variables
):
tainted_contracts[contract.name].add_tainted_variable(var) tainted_contracts[contract.name].add_tainted_variable(var)
elif ( elif (
isinstance(target, StateVariable) isinstance(target, StateVariable)
@ -263,9 +260,8 @@ def tainted_external_contracts(funcs: List[Function]) -> List[TaintedExternalCon
+ contract.get_functions_writing_to_variable(var) + contract.get_functions_writing_to_variable(var)
) )
for f in read_write: for f in read_write:
if ( if f not in tainted_contracts[contract.name].tainted_functions and not (
f not in tainted_contracts[contract.name].tainted_functions f.is_constructor or f.is_fallback or f.is_receive
and not (f.is_constructor or f.is_fallback or f.is_receive)
): ):
c.add_tainted_function(f) c.add_tainted_function(f)
return tainted_list return tainted_list

Loading…
Cancel
Save