Code analysis: Skip invalid code sections. May help #12414.

This commit is contained in:
Henrik Rydgård 2019-10-13 13:25:18 +02:00
parent 94339b2280
commit d64f9c44f3

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;