From e2ee6a396a9ff0f6a850b9a648d828a92a73e64e Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 2 Apr 2025 12:02:24 -0400 Subject: [SharedCache] Fix thrown exception in stub function analysis with mismatched expression operation --- view/sharedcache/workflow/SharedCacheWorkflow.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'view/sharedcache/workflow/SharedCacheWorkflow.cpp') diff --git a/view/sharedcache/workflow/SharedCacheWorkflow.cpp b/view/sharedcache/workflow/SharedCacheWorkflow.cpp index 766164b8..8046ed22 100644 --- a/view/sharedcache/workflow/SharedCacheWorkflow.cpp +++ b/view/sharedcache/workflow/SharedCacheWorkflow.cpp @@ -156,12 +156,11 @@ void AnalyzeStubFunction(Ref func, Ref mlil, Sh // set the variables value. auto def = mlil->GetSSAVarDefinition(var); auto defInstr = mlil->GetInstruction(def); - // TODO: This is 100% not OK, you need to verify the expr operation! - // targetOffset should be the address from where we load the jump address (i.e. the stub island). - const auto islandPtr = defInstr.GetSourceExpr().GetSourceExpr().GetConstant(); - loadTarget(islandPtr); + if (defInstr.operation != MLIL_SET_VAR_SSA) + return; + expr = defInstr.GetSourceExpr(); + // Fallthrough to load ptr. } - break; case MLIL_LOAD_SSA: expr = expr.GetSourceExpr(); if (expr.operation != MLIL_CONST_PTR) @@ -330,10 +329,8 @@ void SharedCacheWorkflow::Register() // Register and insert activities here. ObjCActivity::Register(*workflow); - workflow->RegisterActivity(new Activity("core.analysis.sharedCache.processStubFunction", &AnalyzeFunction)); - std::vector inserted = { - "core.analysis.sharedCache.processStubFunction" - }; + workflow->RegisterActivity(new Activity("core.analysis.sharedCache.analysis", &AnalyzeFunction)); + std::vector inserted = { "core.analysis.sharedCache.analysis" }; workflow->Insert("core.function.analyzeTailCalls", inserted); static constexpr auto WORKFLOW_DESCRIPTION = R"({ -- cgit v1.3.1