Skip to content

Commit

Permalink
Fix crash when utilizing the Obj-C Plugin on Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
0cyn committed Jan 27, 2023
1 parent d1cc1b6 commit b5a1359
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Constants.h"
#include "DataRenderers.h"
#include "Workflow.h"
#include "ArchitectureHooks.h"

extern "C" {

Expand All @@ -23,6 +24,18 @@ BINARYNINJAPLUGIN bool CorePluginInit()
Workflow::registerActivities();
Commands::registerCommands();

std::vector<BinaryNinja::Ref<BinaryNinja::Architecture>> targets = {
BinaryNinja::Architecture::GetByName("aarch64"),
BinaryNinja::Architecture::GetByName("x86_64")
};
for (auto& target : targets) {
if (target)
{
auto* currentHook = new CFStringArchitectureHook(target);
target->Register(currentHook);
}
}

BinaryNinja::LogRegistry::CreateLogger(PluginLoggerName);

return true;
Expand Down
2 changes: 0 additions & 2 deletions Workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ void Workflow::inlineMethodCalls(AnalysisContextRef ac)
if (!GlobalState::hasAnalysisInfo(bv)) {
SharedAnalysisInfo info;
CustomTypes::defineAll(bv);
CFStringArchitectureHook* currentHook = new CFStringArchitectureHook(bv->GetDefaultArchitecture());
bv->GetDefaultArchitecture()->Register(currentHook);
auto messageHandler = GlobalState::messageHandler(bv);

try {
Expand Down

0 comments on commit b5a1359

Please sign in to comment.