mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-25 13:42:06 +00:00
Merge branch 'GP-2973_ryanmkurtz_pe-symbols'
This commit is contained in:
commit
cbba392386
@ -318,7 +318,7 @@ public class FileHeader implements StructConverter {
|
||||
return ptrToSections;
|
||||
}
|
||||
|
||||
void processSections(OptionalHeader optHeader) throws IOException {
|
||||
void processSections(OptionalHeader optHeader, boolean symbolsProcessed) throws IOException {
|
||||
long oldIndex = reader.getPointerIndex();
|
||||
|
||||
int tmpIndex = getPointerToSections();
|
||||
@ -329,7 +329,7 @@ public class FileHeader implements StructConverter {
|
||||
Msg.error(this, "File alignment == 0: section processing skipped");
|
||||
}
|
||||
else {
|
||||
long stringTableOffset = getStringTableOffset();
|
||||
long stringTableOffset = symbolsProcessed ? getStringTableOffset() : -1;
|
||||
sectionHeaders = new SectionHeader[numberOfSections];
|
||||
for (int i = 0; i < numberOfSections; ++i) {
|
||||
SectionHeader section =
|
||||
|
@ -255,6 +255,7 @@ public class NTHeader implements StructConverter, OffsetValidator {
|
||||
}
|
||||
tmpIndex += FileHeader.IMAGE_SIZEOF_FILE_HEADER;
|
||||
|
||||
// Process Optional Header. Abort load on failure.
|
||||
try {
|
||||
optionalHeader = new OptionalHeaderImpl(this, reader, tmpIndex);
|
||||
}
|
||||
@ -263,9 +264,22 @@ public class NTHeader implements StructConverter, OffsetValidator {
|
||||
return;
|
||||
}
|
||||
|
||||
fileHeader.processSections(optionalHeader);
|
||||
fileHeader.processSymbols();
|
||||
// Process symbols. Allow parsing to continue on failure.
|
||||
boolean symbolsProcessed = false;
|
||||
try {
|
||||
fileHeader.processSymbols();
|
||||
symbolsProcessed = true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
Msg.error(this, "Failed to process symbols: " + e.getMessage());
|
||||
}
|
||||
|
||||
// Process sections. Resolving some sections names (i.e., "/21") requires symbols to have
|
||||
// been successfully processed. Resolving is optional though.
|
||||
fileHeader.processSections(optionalHeader, symbolsProcessed);
|
||||
|
||||
// Perform advanced processing. If advanced processing is disabled, these things may be
|
||||
// independently parsed later in the load if they are needed.
|
||||
if (advancedProcess) {
|
||||
optionalHeader.processDataDirectories(TaskMonitor.DUMMY);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user