|
|
@ -258,23 +258,27 @@ class IntegerOverflowUnderflowModule(DetectionModule): |
|
|
|
Adds all the annotations into the state which correspond to the |
|
|
|
Adds all the annotations into the state which correspond to the |
|
|
|
locations in the memory returned by RETURN opcode. |
|
|
|
locations in the memory returned by RETURN opcode. |
|
|
|
:param state: The Global State |
|
|
|
:param state: The Global State |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stack = state.mstate.stack |
|
|
|
stack = state.mstate.stack |
|
|
|
try: |
|
|
|
try: |
|
|
|
offset, length = get_concrete_int(stack[-1]), get_concrete_int(stack[-2]) |
|
|
|
offset, length = get_concrete_int(stack[-1]), get_concrete_int(stack[-2]) |
|
|
|
except TypeError: |
|
|
|
except TypeError: |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state_annotation = _get_overflowunderflow_state_annotation(state) |
|
|
|
|
|
|
|
|
|
|
|
for element in state.mstate.memory[offset : offset + length]: |
|
|
|
for element in state.mstate.memory[offset : offset + length]: |
|
|
|
|
|
|
|
|
|
|
|
if not isinstance(element, Expression): |
|
|
|
if not isinstance(element, Expression): |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
state_annotation = _get_overflowunderflow_state_annotation(state) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for annotation in element.annotations: |
|
|
|
for annotation in element.annotations: |
|
|
|
if isinstance(annotation, OverUnderflowAnnotation): |
|
|
|
if isinstance(annotation, OverUnderflowAnnotation): |
|
|
|
state_annotation.overflowing_state_annotations.append(annotation) |
|
|
|
state_annotation.overflowing_state_annotations.append(annotation) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
def _handle_transaction_end(self, state: GlobalState) -> None: |
|
|
|
def _handle_transaction_end(self, state: GlobalState) -> None: |
|
|
|
|
|
|
|
|
|
|
|
state_annotation = _get_overflowunderflow_state_annotation(state) |
|
|
|
state_annotation = _get_overflowunderflow_state_annotation(state) |
|
|
|