From d6594f2f87c04141e9fe18fa0dd5315646c5ae91 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 12 Feb 2019 23:08:24 +0000 Subject: [PATCH] Add support of Type for SSA (abi.decode() takes a type as argument) --- slither/analyses/data_dependency/data_dependency.py | 3 ++- slither/slithir/utils/ssa.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/slither/analyses/data_dependency/data_dependency.py b/slither/analyses/data_dependency/data_dependency.py index 94e3e534a..d22c73773 100644 --- a/slither/analyses/data_dependency/data_dependency.py +++ b/slither/analyses/data_dependency/data_dependency.py @@ -9,6 +9,7 @@ from slither.slithir.variables import (Constant, LocalIRVariable, ReferenceVariable, ReferenceVariableSSA, StateIRVariable, TemporaryVariable, TemporaryVariableSSA, TupleVariableSSA) +from slither.core.solidity_types.type import Type ################################################################################### ################################################################################### @@ -261,7 +262,7 @@ def compute_dependency_function(function): def convert_variable_to_non_ssa(v): if isinstance(v, (LocalIRVariable, StateIRVariable, TemporaryVariableSSA, ReferenceVariableSSA, TupleVariableSSA)): return v.non_ssa_version - assert isinstance(v, (Constant, SolidityVariable, Contract, Enum, SolidityFunction, Structure, Function)) + assert isinstance(v, (Constant, SolidityVariable, Contract, Enum, SolidityFunction, Structure, Function, Type)) return v def convert_to_non_ssa(data_depencies): diff --git a/slither/slithir/utils/ssa.py b/slither/slithir/utils/ssa.py index d2e983616..3ef917dbd 100644 --- a/slither/slithir/utils/ssa.py +++ b/slither/slithir/utils/ssa.py @@ -4,6 +4,7 @@ from slither.core.cfg.node import NodeType from slither.core.declarations import (Contract, Enum, Function, SolidityFunction, SolidityVariable, SolidityVariableComposed, Structure) +from slither.core.solidity_types.type import Type from slither.core.variables.local_variable import LocalVariable from slither.core.variables.state_variable import StateVariable from slither.slithir.operations import (Assignment, Balance, Binary, Condition, @@ -468,7 +469,8 @@ def get(variable, local_variables_instances, state_variables_instances, temporar Enum, SolidityFunction, Structure, - Function)) + Function, + Type)) # type for abi.decode(.., t) return variable def get_variable(ir, f, *instances):