diff options
| author | Mark Rowe <mark@vector35.com> | 2025-12-01 13:01:27 -0800 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-12-01 22:08:57 -0800 |
| commit | 2a6ad0fe00f8835093fdd4a97082c37df7a2923a (patch) | |
| tree | 3dea7ac66fcaf046011d5f2cf86661ea8b16832e /plugins | |
| parent | 83f2c99693705a9fd979732898f3ef81b8ecbdfc (diff) | |
[ObjC] Support removing reference counting operations in more places in the shared cache
Dataflow is now used to determine call targets when detecting calls to
reference counting runtime functions. The previous approach of matching
on specific instructions missed some patterns that are common in the
shared cache.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/workflow_objc/src/activities/remove_memory_management.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/workflow_objc/src/activities/remove_memory_management.rs b/plugins/workflow_objc/src/activities/remove_memory_management.rs index 470c3152..3990f010 100644 --- a/plugins/workflow_objc/src/activities/remove_memory_management.rs +++ b/plugins/workflow_objc/src/activities/remove_memory_management.rs @@ -11,6 +11,7 @@ use binaryninja::{ lifting::LowLevelILLabel, LowLevelILRegisterKind, }, + variable::PossibleValueSet, workflow::AnalysisContext, }; @@ -36,10 +37,12 @@ fn is_call_to_ignorable_memory_management_function<'func>( ) -> bool { let target = match instr.kind() { LowLevelILInstructionKind::Call(call) | LowLevelILInstructionKind::TailCall(call) => { - let LowLevelILExpressionKind::ConstPtr(address) = call.target().kind() else { - return false; - }; - address.value() + match call.target().possible_values() { + PossibleValueSet::ConstantValue { value } + | PossibleValueSet::ConstantPointerValue { value } + | PossibleValueSet::ImportedAddressValue { value } => value as u64, + _ => return false, + } } LowLevelILInstructionKind::Goto(target) => target.address(), _ => return false, |
