Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Fix the bug of checking loop limit #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions oyente/symExec.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,18 +594,24 @@ def sym_exec_block(params, block, pre_block, depth, func_call, current_func_name

if visited_edges[current_edge] > global_params.LOOP_LIMIT:
log.debug("Overcome a number of loop limit. Terminating this path ...")
updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})
return stack

current_gas_used = analysis["gas"]
if current_gas_used > global_params.GAS_LIMIT:
log.debug("Run out of gas. Terminating this path ... ")
updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})
return stack

# Execute every instruction, one at a time
try:
block_ins = vertices[block].get_instructions()
except KeyError:
log.debug("This path results in an exception, possibly an invalid jump address")
updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})
return ["ERROR"]

for instr in block_ins:
Expand Down Expand Up @@ -719,13 +725,13 @@ def sym_exec_block(params, block, pre_block, depth, func_call, current_func_name
if global_params.DEBUG_MODE:
traceback.print_exc()
solver.pop() # POP SOLVER CONTEXT
updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})
else:
updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})
raise Exception('Unknown Jump-Type')

updated_count_number = visited_edges[current_edge] - 1
visited_edges.update({current_edge: updated_count_number})

# Symbolically executing an instruction
def sym_exec_ins(params, block, instr, func_call, current_func_name):
Expand Down