Skip to content

Commit

Permalink
ghidra: fix UnboundLocalError exception (#1881)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-hunhoff authored Dec 16, 2023
1 parent 2dbac05 commit 382c20c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions capa/features/extractors/ghidra/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ def extract_file_strings() -> Iterator[Tuple[Feature, Address]]:
"""extract ASCII and UTF-16 LE strings"""

for block in currentProgram().getMemory().getBlocks(): # type: ignore [name-defined] # noqa: F821
if block.isInitialized():
p_bytes = capa.features.extractors.ghidra.helpers.get_block_bytes(block)
if not block.isInitialized():
continue

p_bytes = capa.features.extractors.ghidra.helpers.get_block_bytes(block)

for s in capa.features.extractors.strings.extract_ascii_strings(p_bytes):
offset = block.getStart().getOffset() + s.offset
Expand Down

0 comments on commit 382c20c

Please sign in to comment.