Skip to content

Commit

Permalink
Fix variable renamed in the new py-evm library.
Browse files Browse the repository at this point in the history
  • Loading branch information
palkeo committed Jan 14, 2020
1 parent 1ad9661 commit d07d270
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pakala/sm.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,18 @@ def solution(variable):
solution = solutions[0]
return solution if isinstance(solution, numbers.Number) else solution.value

self.code.pc = state.pc

while True:
if state.pc >= len(self.code):
return True

op = self.code[state.pc]
self.code.pc += 1
self.coverage[state.pc] += 1

logger.debug("NEW STEP")
logger.debug("Memory: %s", state.memory)
logger.debug("Stack: %s", state.stack)
logger.debug("PC: %i, %#x", state.pc, op)

assert self.code.pc == state.pc + 1
assert isinstance(op, numbers.Number)
assert all(
isinstance(i, claripy.ast.base.BV) for i in state.stack
Expand Down Expand Up @@ -432,6 +428,7 @@ def solution(variable):
return False
elif opcode_values.PUSH1 <= op <= opcode_values.PUSH32:
pushnum = op - opcode_values.PUSH1 + 1
self.code.program_counter = state.pc + 1
raw_value = self.code.read(pushnum)
state.pc += pushnum
state.stack_push(bvv(int.from_bytes(raw_value, byteorder="big")))
Expand Down Expand Up @@ -790,7 +787,7 @@ def get_coverage(self):
logger.debug("Coverage analysis:")
total_lines = 0
covered_lines = 0
self.code.pc = 0
self.code.program_counter = 0
for pc, instruction in enumerate(self.code): # pylint:disable=invalid-name
if pc == len(self.code):
break
Expand Down

0 comments on commit d07d270

Please sign in to comment.