From 5975405fa275163a6506e02cad033dade1364508 Mon Sep 17 00:00:00 2001 From: Harry Kalodner Date: Sat, 12 Feb 2022 01:43:45 -0500 Subject: [PATCH] Resolve special .length and .offset fields for calldata Features were introduced in solidity 0.7.5 --- slither/solc_parsing/yul/parse_yul.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/slither/solc_parsing/yul/parse_yul.py b/slither/solc_parsing/yul/parse_yul.py index 7f31399c5..3c4768d09 100644 --- a/slither/solc_parsing/yul/parse_yul.py +++ b/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) if 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}")