Resolve special .length and .offset fields for calldata

Features were introduced in solidity 0.7.5
pull/1057/head
Harry Kalodner 3 years ago
parent 57bf155694
commit 5975405fa2
  1. 8
      slither/solc_parsing/yul/parse_yul.py

@ -773,6 +773,14 @@ def parse_yul_identifier(root: YulScope, _node: YulNode, ast: Dict) -> Optional[
variable_found = _check_for_state_variable_name(root, potential_name) variable_found = _check_for_state_variable_name(root, potential_name)
if variable_found: if variable_found:
return variable_found return variable_found
var = root.function.get_local_variable_from_name(potential_name)
if var and var.location == "calldata":
return Identifier(var)
if name.endswith(".length"):
potential_name = name[:-7]
var = root.function.get_local_variable_from_name(potential_name)
if var and var.location == "calldata":
return Identifier(var)
raise SlitherException(f"unresolved reference to identifier {name}") raise SlitherException(f"unresolved reference to identifier {name}")

Loading…
Cancel
Save