From 476dfb5307887245ef233221d3e8c73e70211d9a Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:33:45 +0300 Subject: [PATCH] Check if function call is within the same section. --- PowerRecomp/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PowerRecomp/main.cpp b/PowerRecomp/main.cpp index ea35834..d8745b7 100644 --- a/PowerRecomp/main.cpp +++ b/PowerRecomp/main.cpp @@ -183,9 +183,9 @@ int main(int argc, char* argv[]) { size_t address = base + (data - section.data) + PPC_BI(insn); - if (image.symbols.find(address) == image.symbols.end()) + if (address >= section.base && address < section.base + section.size && image.symbols.find(address) == image.symbols.end()) { - auto& fn = functions.emplace_back(Function::Analyze(section.data + address - section.base, section.size - (address - section.base), address)); + auto& fn = functions.emplace_back(Function::Analyze(section.data + address - section.base, section.base + section.size - address, address)); hardcodedFuncCheck(fn); image.symbols.emplace(std::format("sub_{:X}", fn.base), fn.base, fn.size, Symbol_Function); }