Add method that checks if an interesting state is actually caused by a

requires check
pull/161/head
Joran Honig 7 years ago
parent 6b968ac4a5
commit 07e07f549c
  1. 19
      mythril/analysis/modules/integer.py

@ -284,3 +284,22 @@ def _search_children(statespace, node, expression, constraint=[], index=0, depth
results += _search_children(statespace, child, expression, depth=depth + 1, max_depth=max_depth)
return results
def _check_requires(state, node, statespace, constraint):
"""Checks if usage of overflowed statement results in a revert statement"""
instruction = state.get_current_instruction()
if instruction['opcode'] != 'JUMPI':
return False
children = \
[
statespace.nodes[edge.node_to]
for edge in statespace.edges
if edge.node_from == node.uid and _try_constraints(node.constraints, [constraint])
]
for child in children:
opcodes = [s.get_current_instruction()['opcode'] for s in child.states]
if "REVERT" in opcodes:
return True
return False

Loading…
Cancel
Save