Skip to content

Commit

Permalink
binary ninja: fix computation of call graph
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Nov 27, 2024
1 parent 61e1684 commit 99daa63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions capa/features/extractors/binja/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def _build_call_graph(self):
f: Function
for f in self.bv.functions:
for caller in f.callers:
if caller == f:
logger.debug("recursive: 0x%x", f.start)
calls_from[caller.start].add(f.start)
calls_to[f.start].add(caller.start)

Expand Down
6 changes: 3 additions & 3 deletions capa/features/extractors/binja/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def extract_function_calls_to(fh: FunctionHandle):
func: Function = fh.inner

caller: int
for caller in fh.ctx["call_graph"].get("calls_to", []):
for caller in fh.ctx["call_graph"]["calls_to"].get(func.start, []):
if caller == func.start:
continue

Expand All @@ -33,7 +33,7 @@ def extract_function_calls_from(fh: FunctionHandle):
func: Function = fh.inner

callee: int
for callee in fh.ctx["call_graph"].get("calls_from", []):
for callee in fh.ctx["call_graph"]["calls_from"].get(func.start, []):
if callee == func.start:
continue

Expand All @@ -60,7 +60,7 @@ def extract_recursive_call(fh: FunctionHandle):
func: Function = fh.inner

caller: int
for caller in fh.ctx["call_graph"].get("calls_to", []):
for caller in fh.ctx["call_graph"]["calls_to"].get(func.start, []):
if caller == func.start:
yield Characteristic("recursive call"), fh.address
return
Expand Down

0 comments on commit 99daa63

Please sign in to comment.