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,18 +294,25 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
||||||
//We have a relocation table!
|
//We have a relocation table!
|
||||||
int sectionToModify = s->sh_info;
|
int sectionToModify = s->sh_info;
|
||||||
|
|
||||||
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
if (sectionToModify >= 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s",GetSectionName(sectionToModify));
|
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
||||||
continue;
|
{
|
||||||
|
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s",GetSectionName(sectionToModify));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int numRelocs = s->sh_size / sizeof(Elf32_Rel);
|
||||||
|
|
||||||
|
Elf32_Rel *rels = (Elf32_Rel *)GetSectionDataPtr(i);
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
int numRelocs = s->sh_size / sizeof(Elf32_Rel);
|
|
||||||
|
|
||||||
Elf32_Rel *rels = (Elf32_Rel *)GetSectionDataPtr(i);
|
|
||||||
|
|
||||||
DEBUG_LOG(LOADER,"%s: Performing %i relocations on %s",name,numRelocs,GetSectionName(sectionToModify));
|
|
||||||
LoadRelocations(rels, numRelocs);
|
|
||||||
}
|
}
|
||||||
else if (s->sh_type == SHT_REL)
|
else if (s->sh_type == SHT_REL)
|
||||||
{
|
{
|
||||||
|
@ -318,10 +325,17 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
||||||
{
|
{
|
||||||
//We have a relocation table!
|
//We have a relocation table!
|
||||||
int sectionToModify = s->sh_info;
|
int sectionToModify = s->sh_info;
|
||||||
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
if (sectionToModify >= 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(LOADER,"Trying to relocate non-loaded section %s, ignoring",GetSectionName(sectionToModify));
|
if (!(sections[sectionToModify].sh_flags & SHF_ALLOC))
|
||||||
continue;
|
{
|
||||||
|
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.");
|
ERROR_LOG(LOADER,"Traditional relocations unsupported.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue