|
|
@ -30,6 +30,7 @@ def execute(statespace): |
|
|
|
node = statespace.nodes[k] |
|
|
|
node = statespace.nodes[k] |
|
|
|
|
|
|
|
|
|
|
|
for state in node.states: |
|
|
|
for state in node.states: |
|
|
|
|
|
|
|
# pass |
|
|
|
issues += _check_integer_underflow(statespace, state, node) |
|
|
|
issues += _check_integer_underflow(statespace, state, node) |
|
|
|
issues += _check_integer_overflow(statespace, state, node) |
|
|
|
issues += _check_integer_overflow(statespace, state, node) |
|
|
|
|
|
|
|
|
|
|
@ -50,6 +51,8 @@ def _check_integer_overflow(statespace, state, node): |
|
|
|
instruction = state.get_current_instruction() |
|
|
|
instruction = state.get_current_instruction() |
|
|
|
if instruction['opcode'] not in ("ADD", "MUL"): |
|
|
|
if instruction['opcode'] not in ("ADD", "MUL"): |
|
|
|
return issues |
|
|
|
return issues |
|
|
|
|
|
|
|
if instruction['address'] != 755: |
|
|
|
|
|
|
|
return issues |
|
|
|
|
|
|
|
|
|
|
|
# Formulate overflow constraints |
|
|
|
# Formulate overflow constraints |
|
|
|
stack = state.mstate.stack |
|
|
|
stack = state.mstate.stack |
|
|
@ -108,7 +111,6 @@ def _verify_integer_overflow(statespace, node, expr, state, model, constraint, o |
|
|
|
|
|
|
|
|
|
|
|
return _try_constraints(node.constraints, [Not(constraint)]) is not None |
|
|
|
return _try_constraints(node.constraints, [Not(constraint)]) is not None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _try_constraints(constraints, new_constraints): |
|
|
|
def _try_constraints(constraints, new_constraints): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Tries new constraints |
|
|
|
Tries new constraints |
|
|
|