Fix some issues in ether_send module

pull/30/head
Bernhard Mueller 7 years ago
parent d7aac850a4
commit feb8bcfe5c
  1. 19
      mythril/analysis/modules/ether_send.py

@ -50,13 +50,14 @@ def execute(statespace):
node = call.node node = call.node
can_solve = True can_solve = True
constrained = False
index = 0 index = 0
while(can_solve and index < len(node.constraints)): while(can_solve and index < len(node.constraints)):
index += 1
constraint = node.constraints[index] constraint = node.constraints[index]
index += 1
logging.debug("[ETHER_SEND] Constraint: " + str(constraint)) logging.debug("[ETHER_SEND] Constraint: " + str(constraint))
m = re.search(r'storage_([a-z0-9_&^]+)', str(constraint)) m = re.search(r'storage_([a-z0-9_&^]+)', str(constraint))
@ -64,6 +65,8 @@ def execute(statespace):
overwrite = False overwrite = False
if (m): if (m):
constrained = True
idx = m.group(1) idx = m.group(1)
try: try:
@ -73,7 +76,7 @@ def execute(statespace):
if s.tainted: if s.tainted:
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 + "'." 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 + "'."
overwrite = True overwrite = True
break continue
if not overwrite: if not overwrite:
logging.debug("[ETHER_SEND] No storage writes to index " + str(index)) logging.debug("[ETHER_SEND] No storage writes to index " + str(index))
@ -89,10 +92,14 @@ def execute(statespace):
# CALLER may also be constrained to hardcoded address. I.e. 'caller' and some integer # CALLER may also be constrained to hardcoded address. I.e. 'caller' and some integer
elif (re.search(r"caller", str(constraint)) and re.search(r'[0-9]{20}', str(constraint))): elif (re.search(r"caller", str(constraint)) and re.search(r'[0-9]{20}', str(constraint))):
can_solve = False constrained = True
break can_solve = False
else: break
description += "\nIt seems that this function can be called without restrictions."
if not constrained:
description += "It seems that this function can be called without restrictions."
if can_solve: if can_solve:

Loading…
Cancel
Save