Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Catch exceptions during analysis, info handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpalmisc committed Feb 16, 2022
1 parent c969911 commit b983689
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions Plugin/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ void Commands::analyzeStructures(BinaryViewRef bv)
return;
}

SharedAnalysisInfo info;
CustomTypes::defineAll(bv);

auto file = std::make_shared<ObjectiveNinja::BinaryViewFile>(bv);
auto info = ObjectiveNinja::AnalysisProvider::infoForFile(file);
try {
auto file = std::make_shared<ObjectiveNinja::BinaryViewFile>(bv);
info = ObjectiveNinja::AnalysisProvider::infoForFile(file);

InfoHandler::applyInfoToView(info, bv);
InfoHandler::applyInfoToView(info, bv);
} catch (...) {
BinaryNinja::LogError("[Objective Ninja]: Error during analysis. Please report this bug!");
}

GlobalState::setFlag(bv, Flag::DidRunWorkflow);
}
Expand Down
11 changes: 8 additions & 3 deletions Plugin/Workflow/Workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,17 @@ void Workflow::inlineMethodCalls(AnalysisContextRef ac)
std::scoped_lock<std::mutex> lock(g_initialAnalysisMutex);

if (!GlobalState::hasAnalysisInfo(bv)) {
SharedAnalysisInfo info;
CustomTypes::defineAll(bv);

auto file = std::make_shared<ObjectiveNinja::BinaryViewFile>(bv);
auto info = ObjectiveNinja::AnalysisProvider::infoForFile(file);
try {
auto file = std::make_shared<ObjectiveNinja::BinaryViewFile>(bv);
info = ObjectiveNinja::AnalysisProvider::infoForFile(file);

InfoHandler::applyInfoToView(info, bv);
InfoHandler::applyInfoToView(info, bv);
} catch (...) {
BinaryNinja::LogError("[Objective Ninja]: Error during analysis. Please report this bug!");
}

GlobalState::setFlag(bv, Flag::DidRunStructureAnalysis);
GlobalState::storeAnalysisInfo(bv, info);
Expand Down

0 comments on commit b983689

Please sign in to comment.