diff options
| author | Brian Potchik <brian@vector35.com> | 2025-07-02 08:31:11 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2025-07-02 08:31:11 -0400 |
| commit | 8ef4a64be527a85aa0aca5253abcf5c1f14b3770 (patch) | |
| tree | 481f3c05d487787b98e7c9a3d3cb93f6165fe53a /plugins/workflow_objc | |
| parent | da9df164ea310ee6aab900fa940b63d20839c2dc (diff) | |
Fix Objective-C dynamic dispatch setting.
Diffstat (limited to 'plugins/workflow_objc')
| -rw-r--r-- | plugins/workflow_objc/Plugin.cpp | 13 | ||||
| -rw-r--r-- | plugins/workflow_objc/Workflow.cpp | 7 |
2 files changed, 11 insertions, 9 deletions
diff --git a/plugins/workflow_objc/Plugin.cpp b/plugins/workflow_objc/Plugin.cpp index 2773e10a..6323e1a6 100644 --- a/plugins/workflow_objc/Plugin.cpp +++ b/plugins/workflow_objc/Plugin.cpp @@ -31,13 +31,14 @@ BINARYNINJAPLUGIN bool CorePluginInit() BinaryNinja::LogRegistry::CreateLogger(PluginLoggerName); auto settings = BinaryNinja::Settings::Instance(); - settings->RegisterSetting("core.function.objectiveC.rewriteMessageSendTarget", + settings->RegisterSetting("analysis.objectiveC.resolveDynamicDispatch", R"({ - "title" : "Rewrite objc_msgSend calls in IL", - "type" : "boolean", - "default" : false, - "description" : "Message sends of selectors with any visible implementation are replaced with a direct call to the first visible implementation. Note that this can produce false positives if the selector is implemented by more than one class, or shares a name with a method from a system framework." - })"); + "title" : "Resolve Dynamic Dispatch Calls", + "type" : "boolean", + "default" : false, + "aliases": ["core.function.objectiveC.assumeMessageSendTarget", "core.function.objectiveC.rewriteMessageSendTarget"], + "description" : "Replaces objc_msgSend calls with direct calls to the first found implementation when the target method is visible. May produce false positives when multiple classes implement the same selector or when selectors conflict with system framework methods." + })"); return true; } diff --git a/plugins/workflow_objc/Workflow.cpp b/plugins/workflow_objc/Workflow.cpp index 3be2a042..c0c90427 100644 --- a/plugins/workflow_objc/Workflow.cpp +++ b/plugins/workflow_objc/Workflow.cpp @@ -82,7 +82,8 @@ std::vector<std::string> generateArgumentNames(const std::vector<std::string>& c bool Workflow::rewriteMethodCall(LLILFunctionRef ssa, size_t insnIndex) { - const auto bv = ssa->GetFunction()->GetView(); + auto function = ssa->GetFunction(); + const auto bv = function->GetView(); const auto llil = ssa->GetNonSSAForm(); const auto insn = ssa->GetInstruction(insnIndex); const auto params = insn.GetParameterExprs<LLIL_CALL_SSA>(); @@ -143,10 +144,10 @@ bool Workflow::rewriteMethodCall(LLILFunctionRef ssa, size_t insnIndex) } auto funcType = BinaryNinja::Type::FunctionType(retType, cc, callTypeParams); - ssa->GetFunction()->SetAutoCallTypeAdjustment(ssa->GetFunction()->GetArchitecture(), insn.address, {funcType, BN_DEFAULT_CONFIDENCE}); + function->SetAutoCallTypeAdjustment(function->GetArchitecture(), insn.address, {funcType, BN_DEFAULT_CONFIDENCE}); // -- - if (!BinaryNinja::Settings::Instance()->Get<bool>("core.function.objectiveC.rewriteMessageSendTarget", bv)) + if (!BinaryNinja::Settings::Instance()->Get<bool>("analysis.objectiveC.resolveDynamicDispatch", function)) return false; // Check the analysis info for a selector reference corresponding to the |
