Add solver timeout

pull/23/head
Bernhard Mueller 7 years ago
parent 1ce6fbb588
commit 247648df7a
  1. 2
      mythril/analysis/modules/unchecked_suicide.py
  2. 3
      mythril/analysis/solver.py
  3. 9
      mythril/analysis/symbolic.py

@ -57,7 +57,7 @@ def execute(statespace):
for s in statespace.sstors[index]:
if s.tainted:
can_write = Trues
can_write = True
issue.description += "\nThere is a check on storage index " + str(index) + ". This storage index can be written to by calling the function '" + s.node.function_name + "'."
break

@ -3,6 +3,7 @@ from mythril.exceptions import UnsatError
def get_model(constraints):
s = Solver()
s.set("timeout", 2000)
for constraint in constraints:
s.add(constraint)
@ -12,5 +13,5 @@ def get_model(constraints):
return s.model()
else:
raise UnsatError
raise UnsatError

@ -69,19 +69,22 @@ class StateSpace:
def sstor_analysis(self):
logging.debug("Analyzing storage operations...")
logging.info("Analyzing storage operations...")
for index in self.sstors:
for s in self.sstors[index]:
# For now we simply 'taint' every storage location that is reachable without any constraint on msg.sender
taint = True
for constraint in s.node.constraints:
logging.debug("Constraint: " + str(constraint))
# logging.debug("Constraint: " + str(constraint))
if ("caller" in str(constraint)):
s.tainted = False
taint = False
break
if taint:
try:
solver.get_model(s.node.constraints)
s.tainted = True

Loading…
Cancel
Save