Skip to content

Commit

Permalink
Use librz APIs to detect relocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Crabtux committed Mar 15, 2024
1 parent 52a66b3 commit 430e138
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/PcodeFixupPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ void PcodeFixupPreprocessor::fixupSharedReturnJumpToRelocs(RzAnalysisFunction *f
if (xref->type != RZ_ANALYSIS_XREF_TYPE_CODE)
continue;

// If the target location is outside of the current function, and it is a imported function, then do the patch.
// FIXME: Use librz to confirm the target location is an imported function.
RzAnalysisFunction *targetFunction = rz_analysis_get_fcn_in(core->analysis, xref->to, RZ_ANALYSIS_FCN_TYPE_NULL);
if (targetFunction == NULL)
// If the target location is a imported function, then do the patch.
RzBinReloc *reloc = rz_core_get_reloc_to(core, xref->to);
if (reloc != nullptr && reloc->import != nullptr)
{
func->getOverride().insertFlowOverride(Address(arch.getDefaultCodeSpace(), xref->from), Override::CALL_RETURN);
}
Expand Down

0 comments on commit 430e138

Please sign in to comment.