mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
ELF relocation: check that sectionToModify >= 0.
This commit is contained in:
parent
b4977610cc
commit
60189663db
1 changed files with 27 additions and 13 deletions
|
@ -294,6 +294,8 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
|||
//We have a relocation table!
|
||||
int sectionToModify = s->sh_info;
|
||||
|
||||
if (sectionToModify >= 0)
|
||||
{
|
||||
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
||||
{
|
||||
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s",GetSectionName(sectionToModify));
|
||||
|
@ -307,6 +309,11 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
|||
DEBUG_LOG(LOADER,"%s: Performing %i relocations on %s",name,numRelocs,GetSectionName(sectionToModify));
|
||||
LoadRelocations(rels, numRelocs);
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(LOADER, "sectionToModify = %i - ignoring PSP relocation sector %i", sectionToModify, i);
|
||||
}
|
||||
}
|
||||
else if (s->sh_type == SHT_REL)
|
||||
{
|
||||
DEBUG_LOG(LOADER, "Traditional relocation section found.");
|
||||
|
@ -318,11 +325,18 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
|||
{
|
||||
//We have a relocation table!
|
||||
int sectionToModify = s->sh_info;
|
||||
if (sectionToModify >= 0)
|
||||
{
|
||||
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
||||
{
|
||||
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s, ignoring",GetSectionName(sectionToModify));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(LOADER, "sectionToModify = %i - ignoring relocation sector %i", sectionToModify, i);
|
||||
}
|
||||
ERROR_LOG(LOADER,"Traditional relocations unsupported.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue