Merge pull request #12418 from hrydgard/skip-invalid-code-sections

ScanForFunctions: Skip invalid code sections. May help #12414.
This commit is contained in:
Unknown W. Brackets 2019-10-13 06:59:42 -07:00 committed by GitHub
commit 8a6a494599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1274,6 +1274,11 @@ static Module *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAdd
std::vector<SectionID> codeSections = reader.GetCodeSections();
for (SectionID id : codeSections) {
u32 start = reader.GetSectionAddr(id);
if (!Memory::IsValidAddress(start)) {
ERROR_LOG(LOADER, "Bad section addr %08x of section %d", start, id);
continue;
}
// Note: scan end is inclusive.
u32 end = start + reader.GetSectionSize(id) - 4;