Remove dubious parallelization in ELF loading, initialize a var, add some checks

This commit is contained in:
Henrik Rydgård committed 2025-05-15 09:48:23 +02:00
1 parent 67ebee1483
commit fba2489c79
5 files changed
+15 -8

No files matched your search

+8
View File
@@ -1085,6 +1085,14 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
// In this case it's definitely not compressed. Added assert below.
}
// Don't accept ELFs over 32MB.
if (decryptedSize > 32 * 1024 * 1024) {
*error_string = StringFromFormat("ELF/PRX corrupt, unreasonable decrypted size: %d", (u32)decryptedSize);
// TODO: Might be the wrong error code.
error = SCE_KERNEL_ERROR_FILEERR;
return nullptr;
}
// decompress if required.
if (isGzip) {
_dbg_assert_(Read32(ptr + 0x150) != ELF_MAGIC);