diff options
| author | Xusheng <xusheng@vector35.com> | 2024-07-04 16:50:04 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2024-07-09 10:19:48 +0800 |
| commit | 1bab71bba6b2777ebe84313dcf22ec7d4edcd1d7 (patch) | |
| tree | 61190232bacf3dd09e271bb5293dc94d8fd14fe4 | |
| parent | b7e6d1352a1904cfdd90b7f41a03d2b9a4c24f1d (diff) | |
Account for rebasing when processing ELF_STT_FUNC entries. Fix https://github.com/Vector35/binaryninja-api/issues/5685
| -rw-r--r-- | view/elf/elfview.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index c61a5697..bcfcad7e 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -1152,13 +1152,14 @@ bool ElfView::Init() Ref<Symbol> sym = GetSymbolByAddress(gotEntry); if (entry.value && sym && (sym->GetType() == ImportAddressSymbol)) { - Ref<Platform> targetPlatform = platform->GetAssociatedPlatformByAddress(entry.value); - Ref<Function> func = AddFunctionForAnalysis(targetPlatform, entry.value); + uint64_t adjustedAddress = entry.value + imageBaseAdjustment; + Ref<Platform> targetPlatform = platform->GetAssociatedPlatformByAddress(adjustedAddress); + Ref<Function> func = AddFunctionForAnalysis(targetPlatform, adjustedAddress); if (func) { Ref<Symbol> funcSym = new Symbol(ImportedFunctionSymbol, sym->GetShortName(), sym->GetFullName(), sym->GetRawName(), - entry.value, NoBinding, sym->GetNameSpace(), sym->GetOrdinal()); + adjustedAddress, NoBinding, sym->GetNameSpace(), sym->GetOrdinal()); DefineAutoSymbol(funcSym); func->ApplyImportedTypes(funcSym); } |
