mirror of
https://github.com/mandiant/capa.git
synced 2025-12-05 20:40:05 -08:00
binary ninja: fix computation of call graph
This commit is contained in:
@@ -62,8 +62,6 @@ class BinjaFeatureExtractor(StaticFeatureExtractor):
|
|||||||
f: Function
|
f: Function
|
||||||
for f in self.bv.functions:
|
for f in self.bv.functions:
|
||||||
for caller in f.callers:
|
for caller in f.callers:
|
||||||
if caller == f:
|
|
||||||
logger.debug("recursive: 0x%x", f.start)
|
|
||||||
calls_from[caller.start].add(f.start)
|
calls_from[caller.start].add(f.start)
|
||||||
calls_to[f.start].add(caller.start)
|
calls_to[f.start].add(caller.start)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def extract_function_calls_to(fh: FunctionHandle):
|
|||||||
func: Function = fh.inner
|
func: Function = fh.inner
|
||||||
|
|
||||||
caller: int
|
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:
|
if caller == func.start:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ def extract_function_calls_from(fh: FunctionHandle):
|
|||||||
func: Function = fh.inner
|
func: Function = fh.inner
|
||||||
|
|
||||||
callee: int
|
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:
|
if callee == func.start:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ def extract_recursive_call(fh: FunctionHandle):
|
|||||||
func: Function = fh.inner
|
func: Function = fh.inner
|
||||||
|
|
||||||
caller: int
|
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:
|
if caller == func.start:
|
||||||
yield Characteristic("recursive call"), fh.address
|
yield Characteristic("recursive call"), fh.address
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user