Skip to content

Commit

Permalink
binexport: index instruction indices by address
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Sep 11, 2024
1 parent 2cff633 commit 368bc5b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions capa/features/extractors/binexport2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def __init__(self, be2: BinExport2):
self.string_reference_index_by_source_instruction_index: Dict[int, List[int]] = defaultdict(list)

self.insn_address_by_index: Dict[int, int] = {}
self.insn_index_by_address: Dict[int, int] = {}
self.insn_by_address: Dict[int, BinExport2.Instruction] = {}

# must index instructions first
Expand Down Expand Up @@ -187,6 +188,7 @@ def _index_insn_addresses(self):
addr = next_addr
next_addr += len(insn.raw_bytes)
self.insn_address_by_index[idx] = addr
self.insn_index_by_address[addr] = idx
self.insn_by_address[addr] = insn

@staticmethod
Expand Down

0 comments on commit 368bc5b

Please sign in to comment.