From b7c67962d8bb12983a5f3361fab17719363e02d7 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Wed, 25 Jul 2018 13:48:35 +0200 Subject: [PATCH] And use address for comparison in taint analysis --- mythril/laser/ethereum/state.py | 18 ++++++++++-------- mythril/laser/ethereum/taint_analysis.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mythril/laser/ethereum/state.py b/mythril/laser/ethereum/state.py index 07951f6a..032cf66e 100644 --- a/mythril/laser/ethereum/state.py +++ b/mythril/laser/ethereum/state.py @@ -38,13 +38,14 @@ class Account: def add_balance(self, balance): self.balance += balance - def get_storage(self, index): - if index in self.storage.keys(): - return self.storage[index] - else: - symbol = BitVec("storage_" + str(index), 256) - self.storage[index] = symbol - return symbol + # def get_storage(self, index): + # return BitVec("storage_" + str(index), 256) + # if index in self.storage.keys(): + # return self.storage[index] + # else: + # symbol = BitVec("storage_" + str(index), 256) + # self.storage[index] = symbol + # return symbol @property def as_dict(self): @@ -83,6 +84,7 @@ class Environment: def __str__(self): return str(self.as_dict) + @property def as_dict(self): return dict(active_account=self.active_account, sender=self.sender, calldata=self.calldata, @@ -150,7 +152,7 @@ class GlobalState: def __copy__(self): - accounts = self.accounts + accounts = copy(self.accounts) environment = copy(self.environment) mstate = deepcopy(self.mstate) call_stack = copy(self.call_stack) diff --git a/mythril/laser/ethereum/taint_analysis.py b/mythril/laser/ethereum/taint_analysis.py index 37f546a0..441d9e23 100644 --- a/mythril/laser/ethereum/taint_analysis.py +++ b/mythril/laser/ethereum/taint_analysis.py @@ -118,7 +118,7 @@ class TaintRunner: direct_children = [statespace.nodes[edge.node_to] for edge in statespace.edges if edge.node_from == node.uid] children = [] for child in direct_children: - if child.states[0].environment.active_account == environment.active_account: + if child.states[0].environment.active_account.address == environment.active_account.address: children.append(child) else: children += TaintRunner.children(child, statespace, environment)