From b26f8da1248e7f57119e76f5dc89014cd46272e8 Mon Sep 17 00:00:00 2001 From: Simone Date: Mon, 24 Apr 2023 21:23:08 +0200 Subject: [PATCH 1/5] Improve try-catch parsing --- slither/solc_parsing/declarations/function.py | 76 +++++++++++++++++-- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 7438a7bb0f..ab5d289a81 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -660,6 +660,55 @@ def _parse_dowhile(self, do_while_statement: Dict, node: NodeSolc) -> NodeSolc: link_underlying_nodes(node_condition, node_endDoWhile) return node_endDoWhile + # pylint: disable=no-self-use + def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) -> Dict: + # if the parameters are more than 1 we make the leftHandSide of the Assignment node + # a TupleExpression otherwise an Identifier + + ret: Dict = {"nodeType": "Assignment", "operator": "=", "src": parameters_list["src"]} + + parameters = parameters_list.get("parameters", None) + + # if the name is "" it means the return variable is not used + if len(parameters) == 1: + if parameters[0]["name"] != "": + ret["typeDescriptions"] = { + "typeString": parameters[0]["typeName"]["typeDescriptions"]["typeString"] + } + leftHandSide = { + "name": parameters[0]["name"], + "nodeType": "Identifier", + "src": parameters[0]["src"], + "typeDescriptions": parameters[0]["typeDescriptions"], + } + else: + # we don't need an Assignment so we return only the external call + return externalCall + else: + ret["typeDescriptions"] = {"typeString": "tuple()"} + leftHandSide = { + "components": [], + "nodeType": "TupleExpression", + "src": parameters_list["src"], + } + + for p in parameters: + if p["name"] == "": + continue + + ident = { + "name": p["name"], + "nodeType": "Identifier", + "src": p["src"], + "typeDescriptions": p["typeDescriptions"], + } + leftHandSide["components"].append(ident) + + ret["leftHandSide"] = leftHandSide + ret["rightHandSide"] = externalCall + + return ret + def _parse_try_catch(self, statement: Dict, node: NodeSolc) -> NodeSolc: externalCall = statement.get("externalCall", None) @@ -669,15 +718,27 @@ def _parse_try_catch(self, statement: Dict, node: NodeSolc) -> NodeSolc: node.underlying_node.scope.is_checked, False, node.underlying_node.scope ) new_node = self._new_node(NodeType.TRY, statement["src"], catch_scope) - new_node.add_unparsed_expression(externalCall) + clauses = statement.get("clauses", []) + # the first clause is the try scope + returned_variables = clauses[0].get("parameters", None) + constructed_try_expression = self._construct_try_expression( + externalCall, returned_variables + ) + new_node.add_unparsed_expression(constructed_try_expression) link_underlying_nodes(node, new_node) node = new_node - for clause in statement.get("clauses", []): - self._parse_catch(clause, node) + for index, clause in enumerate(clauses): + # clauses after the first one are related to catch cases + # we set the parameters (e.g. data in this case. catch(string memory data) ...) + # to be initialized so they are not reported by the uninitialized-local-variables detector + if index >= 1: + self._parse_catch(clause, node, True) + else: + self._parse_catch(clause, node, False) return node - def _parse_catch(self, statement: Dict, node: NodeSolc) -> NodeSolc: + def _parse_catch(self, statement: Dict, node: NodeSolc, var_initialized: bool) -> NodeSolc: block = statement.get("block", None) if block is None: @@ -695,7 +756,7 @@ def _parse_catch(self, statement: Dict, node: NodeSolc) -> NodeSolc: if params: for param in params.get("parameters", []): assert param[self.get_key()] == "VariableDeclaration" - self._add_param(param) + self._add_param(param, var_initialized) return self._parse_statement(block, try_node, try_scope) @@ -1161,7 +1222,7 @@ def _fix_catch(self, node: Node, end_node: Node, visited: Set[Node]) -> None: visited.add(son) self._fix_catch(son, end_node, visited) - def _add_param(self, param: Dict) -> LocalVariableSolc: + def _add_param(self, param: Dict, initialized: bool = False) -> LocalVariableSolc: local_var = LocalVariable() local_var.set_function(self._function) @@ -1171,6 +1232,9 @@ def _add_param(self, param: Dict) -> LocalVariableSolc: local_var_parser.analyze(self) + if initialized: + local_var.initialized = True + # see https://solidity.readthedocs.io/en/v0.4.24/types.html?highlight=storage%20location#data-location if local_var.location == "default": local_var.set_location("memory") From d7b0d612c64eefc4bce33cdc4b09c6c740837a94 Mon Sep 17 00:00:00 2001 From: Simone Date: Thu, 27 Apr 2023 10:53:20 +0200 Subject: [PATCH 2/5] Improve handling of multiple return variables --- slither/solc_parsing/declarations/function.py | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index ab5d289a81..7ac67a02d7 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -672,6 +672,7 @@ def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) - # if the name is "" it means the return variable is not used if len(parameters) == 1: if parameters[0]["name"] != "": + self._add_param(parameters[0]) ret["typeDescriptions"] = { "typeString": parameters[0]["typeName"]["typeDescriptions"]["typeString"] } @@ -692,10 +693,17 @@ def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) - "src": parameters_list["src"], } - for p in parameters: + for i, p in enumerate(parameters): if p["name"] == "": continue + new_statement = { + "nodeType": "VariableDefinitionStatement", + "src": p["src"], + "declarations": [p], + } + self._add_param_init_tuple(new_statement, i) + ident = { "name": p["name"], "nodeType": "Identifier", @@ -735,10 +743,11 @@ def _parse_try_catch(self, statement: Dict, node: NodeSolc) -> NodeSolc: if index >= 1: self._parse_catch(clause, node, True) else: + # the parameters for the try scope were already added in _construct_try_expression self._parse_catch(clause, node, False) return node - def _parse_catch(self, statement: Dict, node: NodeSolc, var_initialized: bool) -> NodeSolc: + def _parse_catch(self, statement: Dict, node: NodeSolc, add_param: bool) -> NodeSolc: block = statement.get("block", None) if block is None: @@ -748,15 +757,16 @@ def _parse_catch(self, statement: Dict, node: NodeSolc, var_initialized: bool) - try_node = self._new_node(NodeType.CATCH, statement["src"], try_scope) link_underlying_nodes(node, try_node) - if self.is_compact_ast: - params = statement.get("parameters", None) - else: - params = statement[self.get_children("children")] + if add_param: + if self.is_compact_ast: + params = statement.get("parameters", None) + else: + params = statement[self.get_children("children")] - if params: - for param in params.get("parameters", []): - assert param[self.get_key()] == "VariableDeclaration" - self._add_param(param, var_initialized) + if params: + for param in params.get("parameters", []): + assert param[self.get_key()] == "VariableDeclaration" + self._add_param(param, True) return self._parse_statement(block, try_node, try_scope) @@ -1242,6 +1252,17 @@ def _add_param(self, param: Dict, initialized: bool = False) -> LocalVariableSol self._add_local_variable(local_var_parser) return local_var_parser + def _add_param_init_tuple(self, statement: Dict, index: int) -> LocalVariableInitFromTupleSolc: + + local_var = LocalVariableInitFromTuple() + local_var.set_function(self._function) + local_var.set_offset(statement["src"], self._function.compilation_unit) + + local_var_parser = LocalVariableInitFromTupleSolc(local_var, statement, index) + + self._add_local_variable(local_var_parser) + return local_var_parser + def _parse_params(self, params: Dict): assert params[self.get_key()] == "ParameterList" From 50876cf368bca53cada09234ee1096b2991af3d7 Mon Sep 17 00:00:00 2001 From: Simone Date: Thu, 27 Apr 2023 11:13:01 +0200 Subject: [PATCH 3/5] Handle when there aren't return variables --- slither/solc_parsing/declarations/function.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 7ac67a02d7..57d7784e55 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -665,6 +665,11 @@ def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) - # if the parameters are more than 1 we make the leftHandSide of the Assignment node # a TupleExpression otherwise an Identifier + # case when there isn't returns(...) + # e.g. external call that doesn't have any return variable + if not parameters_list: + return externalCall + ret: Dict = {"nodeType": "Assignment", "operator": "=", "src": parameters_list["src"]} parameters = parameters_list.get("parameters", None) From 6eb296cdf71ebd48ccab7e24ca99ba89a3b2c171 Mon Sep 17 00:00:00 2001 From: Simone Date: Thu, 27 Apr 2023 11:23:03 +0200 Subject: [PATCH 4/5] Test catch variables not detected as uninitialized --- ...11_uninitialized_local_variable_sol__0.txt | 2 +- ..._6_uninitialized_local_variable_sol__0.txt | 2 +- .../0.6.11/uninitialized_local_variable.sol | 14 +++++++++++++- ...ninitialized_local_variable.sol-0.6.11.zip | Bin 1824 -> 2712 bytes .../0.7.6/uninitialized_local_variable.sol | 14 +++++++++++++- ...uninitialized_local_variable.sol-0.7.6.zip | Bin 1762 -> 2649 bytes 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_6_11_uninitialized_local_variable_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_6_11_uninitialized_local_variable_sol__0.txt index 8e5dc65e87..7e5fa9559a 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_6_11_uninitialized_local_variable_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_6_11_uninitialized_local_variable_sol__0.txt @@ -1,2 +1,2 @@ -Uninitialized.func().uint_not_init (tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol#4) is a local variable never initialized +Uninitialized.func().uint_not_init (tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol#8) is a local variable never initialized diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_7_6_uninitialized_local_variable_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_7_6_uninitialized_local_variable_sol__0.txt index 495859ec1b..7bf1564d70 100644 --- a/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_7_6_uninitialized_local_variable_sol__0.txt +++ b/tests/e2e/detectors/snapshots/detectors__detector_UninitializedLocalVars_0_7_6_uninitialized_local_variable_sol__0.txt @@ -1,2 +1,2 @@ -Uninitialized.func().uint_not_init (tests/e2e/detectors/test_data/uninitialized-local/0.7.6/uninitialized_local_variable.sol#4) is a local variable never initialized +Uninitialized.func().uint_not_init (tests/e2e/detectors/test_data/uninitialized-local/0.7.6/uninitialized_local_variable.sol#8) is a local variable never initialized diff --git a/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol b/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol index d28eef9578..00a4fbc86a 100644 --- a/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol +++ b/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol @@ -1,9 +1,21 @@ +interface I { + function a() external; +} + contract Uninitialized{ function func() external returns(uint){ uint uint_not_init; uint uint_init = 1; return uint_not_init + uint_init; - } + } + + function func_try_catch(I i) external returns(uint) { + try i.a() { + return 1; + } catch (bytes memory data) { + data; + } + } } diff --git a/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol-0.6.11.zip b/tests/e2e/detectors/test_data/uninitialized-local/0.6.11/uninitialized_local_variable.sol-0.6.11.zip index ca7ea0eb308fe7b52d4395dd5171d8bdbf5d44f2..d5b1203065287433605f4fdd799d6e32862f7048 100644 GIT binary patch delta 2557 zcmV@KL7#%4gfV;n^xf(0*uZH003G%kr-ru^+P_6+Z$mK{=)<4#k(GbXB?s{~H=a zs3iZSL1y6a%c)g=c8>~Gzo559b-?F@wye`NK)+y_mW4~=J%l}F&*_)3Aiw|>(5`1O z>!tfUafTu?!!Sn&5*^ygdzy;8H7BLD=W~5~y=n%^pC9f{{R3Z~-k2`0P=BWZarpw# z!zcOOX?_oKPLE`8q-&F=(Jlr8F_nz>CnbC5Gm$7Q_roxMvgz4;#M+XVKe_~?6~*)G z26CcKqL-st$F@hZVKEU8XrU)6Ihxs4zJ|Em2x!1)dSG=3twk5gJai^t9(CeW_8Nt`A$c4AX z!L9X_Ei*B|sO$6_X_rU+nB?ES!a)PZsLAabL*!3?g6Xf4bHyJa?PCv%`vycUDY(-! z(1EBBrk2I@e{v8*{XplTytWpbb+nv)nnL`K@Z17&f>E5R7N2YoDRSeU809V#IR@R_ zic$9uusQfhSOrMN;HFQU%y9@8S^ZHaHu{)hz|;nC&5gnj(QP<)`7X4lnR`ju=`Q4u3K1Wif)?Ka-kMexshf9 zo|cCbj)BxSi}FzHAzbngE*`UQ*x6MFfRh&zUvT1wVpT6}w0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1-l^%Nm&p`Ep%&DVa|q(*RM_|u##Crc}ZQv6@)9c zFoVs2zDZa{F^U!c-CK~-P)h* Date: Wed, 10 May 2023 16:34:05 +0200 Subject: [PATCH 5/5] Fix multiple try catch with same return var name --- slither/solc_parsing/declarations/function.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 57d7784e55..ed1fbcd7fa 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -685,6 +685,7 @@ def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) - "name": parameters[0]["name"], "nodeType": "Identifier", "src": parameters[0]["src"], + "referencedDeclaration": parameters[0]["id"], "typeDescriptions": parameters[0]["typeDescriptions"], } else: @@ -713,6 +714,7 @@ def _construct_try_expression(self, externalCall: Dict, parameters_list: Dict) - "name": p["name"], "nodeType": "Identifier", "src": p["src"], + "referencedDeclaration": p["id"], "typeDescriptions": p["typeDescriptions"], } leftHandSide["components"].append(ident)