Add fallback/receive as shadowed builtin

pull/463/head
Josselin 5 years ago
parent fc4cc3bad9
commit 542ec891a1
  1. 4
      slither/detectors/shadowing/builtin_symbols.py

@ -50,7 +50,7 @@ contract Bug {
BUILTIN_SYMBOLS = ["assert", "require", "revert", "block", "blockhash", BUILTIN_SYMBOLS = ["assert", "require", "revert", "block", "blockhash",
"gasleft", "msg", "now", "tx", "this", "addmod", "mulmod", "gasleft", "msg", "now", "tx", "this", "addmod", "mulmod",
"keccak256", "sha256", "sha3", "ripemd160", "ecrecover", "keccak256", "sha256", "sha3", "ripemd160", "ecrecover",
"selfdestruct", "suicide", "abi"] "selfdestruct", "suicide", "abi", "fallback", "receive"]
# https://solidity.readthedocs.io/en/v0.5.2/miscellaneous.html#reserved-keywords # https://solidity.readthedocs.io/en/v0.5.2/miscellaneous.html#reserved-keywords
RESERVED_KEYWORDS = ['abstract', 'after', 'alias', 'apply', 'auto', 'case', 'catch', 'copyof', RESERVED_KEYWORDS = ['abstract', 'after', 'alias', 'apply', 'auto', 'case', 'catch', 'copyof',
@ -92,6 +92,8 @@ contract Bug {
# Loop through all functions, modifiers, variables (state and local) to detect any built-in symbol keywords. # Loop through all functions, modifiers, variables (state and local) to detect any built-in symbol keywords.
for function in contract.functions_declared: for function in contract.functions_declared:
if self.is_builtin_symbol(function.name): if self.is_builtin_symbol(function.name):
if function.is_fallback or function.is_receive:
continue
result.append((self.SHADOWING_FUNCTION, function)) result.append((self.SHADOWING_FUNCTION, function))
result += self.detect_builtin_shadowing_locals(function) result += self.detect_builtin_shadowing_locals(function)
for modifier in contract.modifiers_declared: for modifier in contract.modifiers_declared:

Loading…
Cancel
Save