bugfix: crash when loading elf
This commit is contained in:
parent
eb6dfb4bfa
commit
7b350c09b9
|
@ -2604,12 +2604,6 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
||||||
sh = (ELFSectionHeader**)
|
sh = (ELFSectionHeader**)
|
||||||
malloc(sizeof(ELFSectionHeader*) * count);
|
malloc(sizeof(ELFSectionHeader*) * count);
|
||||||
|
|
||||||
stringTable = (char*)elfReadSection(data, sh[READ16LE(&eh->e_shstrndx)]);
|
|
||||||
|
|
||||||
elfSectionHeaders = sh;
|
|
||||||
elfSectionHeadersStringTable = stringTable;
|
|
||||||
elfSectionHeadersCount = count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
sh[i] = (ELFSectionHeader*)p;
|
sh[i] = (ELFSectionHeader*)p;
|
||||||
p += sizeof(ELFSectionHeader);
|
p += sizeof(ELFSectionHeader);
|
||||||
|
@ -2617,6 +2611,12 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
||||||
p += READ16LE(&eh->e_shentsize) - sizeof(ELFSectionHeader);
|
p += READ16LE(&eh->e_shentsize) - sizeof(ELFSectionHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stringTable = (char*)elfReadSection(data, sh[READ16LE(&eh->e_shstrndx)]);
|
||||||
|
|
||||||
|
elfSectionHeaders = sh;
|
||||||
|
elfSectionHeadersStringTable = stringTable;
|
||||||
|
elfSectionHeadersCount = count;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
// printf("SH %d %-20s %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
// printf("SH %d %-20s %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||||
// i, &stringTable[sh[i]->name], sh[i]->name, sh[i]->type,
|
// i, &stringTable[sh[i]->name], sh[i]->name, sh[i]->type,
|
||||||
|
|
Loading…
Reference in New Issue