mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-31 03:26:47 +01:00
Loader: Skip the exports of a module whose export table isn't in memory
A module cut off before its relocations still has link-time addresses in its module info. Reading its export table through them raised a memory exception, which stops the interpreter (the JITs carry on), so modules/cutrel failed with --cpu=interpreter. Check the range first, as the import side already does for libstub. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d1ddaf9681
commit
2344d70147
1 file changed
+10
-2
@@ -2050,8 +2050,16 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
|
||||
module->nm.stub_top = modinfo->libstub;
|
||||
module->nm.stub_size = modinfo->libstubend - modinfo->libstub;
|
||||
|
||||
const u32_le *entPos = (u32_le *)Memory::GetPointerOrException(modinfo->libent);
|
||||
const u32_le *entEnd = (u32_le *)Memory::GetPointerOrException(modinfo->libentend);
|
||||
const u32_le *entPos = nullptr;
|
||||
const u32_le *entEnd = nullptr;
|
||||
// A module that wasn't relocated (cut off before its relocations, see LoadInto) still has
|
||||
// link-time addresses here.
|
||||
if (Memory::IsValidRange(modinfo->libent, modinfo->libentend - modinfo->libent)) {
|
||||
entPos = (const u32_le *)Memory::GetPointerUnchecked(modinfo->libent);
|
||||
entEnd = (const u32_le *)Memory::GetPointerUnchecked(modinfo->libentend);
|
||||
} else {
|
||||
WARN_LOG(Log::Loader, "Garbage libent address %08x or end %08x, no exports", modinfo->libent, modinfo->libentend);
|
||||
}
|
||||
|
||||
for (int m = 0; entPos < entEnd; ++m) {
|
||||
const PspLibEntEntry *ent = (const PspLibEntEntry *)entPos;
|
||||
|
||||
Reference in new issue
Block a user