fix: don't extract invalid calls from features (#1285)

This commit is contained in:
Moritz
2023-01-19 11:56:13 +01:00
committed by GitHub
parent 607daa345e
commit b8de9625ee
2 changed files with 5 additions and 2 deletions

View File

@@ -88,6 +88,7 @@
- render: fix verbose rendering of scopes #1263 @williballenthin
- rules: better detect invalid rules #1282 @williballenthin
- show-features: better render strings with embedded whitespace #1267 @williballenthin
- extractor: guard against invalid "calls from" features #1177 @mr-tz
### capa explorer IDA Pro plugin
- fix: display instruction items #1154 @mr-tz

View File

@@ -493,7 +493,8 @@ def extract_function_calls_from(fh: FunctionHandle, bb, ih: InsnHandle) -> Itera
if isinstance(insn.opers[0], envi.archs.i386.disasm.i386ImmMemOper):
oper = insn.opers[0]
target = oper.getOperAddr(insn)
yield Characteristic("calls from"), AbsoluteVirtualAddress(target)
if target >= 0:
yield Characteristic("calls from"), AbsoluteVirtualAddress(target)
# call via thunk on x86,
# see 9324d1a8ae37a36ae560c37448c9705a at 0x407985
@@ -509,7 +510,8 @@ def extract_function_calls_from(fh: FunctionHandle, bb, ih: InsnHandle) -> Itera
elif isinstance(insn.opers[0], envi.archs.amd64.disasm.Amd64RipRelOper):
op = insn.opers[0]
target = op.getOperAddr(insn)
yield Characteristic("calls from"), AbsoluteVirtualAddress(target)
if target >= 0:
yield Characteristic("calls from"), AbsoluteVirtualAddress(target)
if target and target == f.va:
# if we found a jump target and it's the function address