From 0da82d3250e9a700067e89fc3f68b98a3161142e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 8 May 2023 16:42:33 +0200 Subject: [PATCH] ElfLoader: Don't scan for functions in zero-length sections We end up scanning a crazy range from 0 to 0xFFFFFFFFC, which causes problems. Happens in WWE: Smackdown Vs Raw 2009 during initial load. --- Core/HLE/sceKernelModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index e52176a9b106..37773c66cf11 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1412,6 +1412,10 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load // Note: scan end is inclusive. u32 end = start + reader.GetSectionSize(id) - 4; u32 len = end + 4 - start; + if (len == 0) { + // Seen in WWE: Smackdown vs Raw 2009. See #17435. + continue; + } if (!Memory::IsValidRange(start, len)) { ERROR_LOG(LOADER, "Bad section %08x (len %08x) of section %d", start, len, id); continue;