mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Loader: If the module range is bad, don't get stuck trying to scan for functions.
Better crash immediately (although that's also not ideal).
This commit is contained in:
parent
ff7bf318af
commit
c2e8577756
1 changed files with 14 additions and 9 deletions
|
@ -1334,16 +1334,21 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
|
|||
if (scan && codeSections.empty()) {
|
||||
u32 scanStart = module->textStart;
|
||||
u32 scanEnd = module->textEnd;
|
||||
// Skip the exports and imports sections, they're not code.
|
||||
if (scanEnd >= std::min(modinfo->libent, modinfo->libstub)) {
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, std::min(modinfo->libent, modinfo->libstub) - 4, insertSymbols);
|
||||
scanStart = std::min(modinfo->libentend, modinfo->libstubend);
|
||||
|
||||
if (Memory::IsValidRange(scanStart, scanEnd - scanStart)) {
|
||||
// Skip the exports and imports sections, they're not code.
|
||||
if (scanEnd >= std::min(modinfo->libent, modinfo->libstub)) {
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, std::min(modinfo->libent, modinfo->libstub) - 4, insertSymbols);
|
||||
scanStart = std::min(modinfo->libentend, modinfo->libstubend);
|
||||
}
|
||||
if (scanEnd >= std::max(modinfo->libent, modinfo->libstub)) {
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, std::max(modinfo->libent, modinfo->libstub) - 4, insertSymbols);
|
||||
scanStart = std::max(modinfo->libentend, modinfo->libstubend);
|
||||
}
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, scanEnd, insertSymbols);
|
||||
} else {
|
||||
ERROR_LOG(LOADER, "Bad text scan range %08x-%08x", scanStart, scanEnd);
|
||||
}
|
||||
if (scanEnd >= std::max(modinfo->libent, modinfo->libstub)) {
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, std::max(modinfo->libent, modinfo->libstub) - 4, insertSymbols);
|
||||
scanStart = std::max(modinfo->libentend, modinfo->libstubend);
|
||||
}
|
||||
insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, scanEnd, insertSymbols);
|
||||
}
|
||||
|
||||
if (scan) {
|
||||
|
|
Loading…
Add table
Reference in a new issue