mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-07-30 07:18:37 -09:00
GP-7079: Handling missing LC_SYMTAB better (Closes #9399)
This commit is contained in:
@@ -42,7 +42,7 @@ public class SymbolTableCommand extends LoadCommand {
|
||||
private long stroff;
|
||||
private long strsize;
|
||||
|
||||
private List<NList> symbols = new ArrayList<NList>();
|
||||
private List<NList> symbols = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates and parses a new {@link SymbolTableCommand}
|
||||
@@ -144,7 +144,7 @@ public class SymbolTableCommand extends LoadCommand {
|
||||
(index & DynamicSymbolTableConstants.INDIRECT_SYMBOL_ABS) != 0) {
|
||||
return null;
|
||||
}
|
||||
if (index > symbols.size()) {
|
||||
if (index >= symbols.size()) {
|
||||
return null;
|
||||
}
|
||||
return symbols.get(index);
|
||||
|
||||
@@ -692,7 +692,8 @@ public class MachoProgramBuilder {
|
||||
for (int i = indirectSymbolTableIndex; i < indirectSymbolTableIndex + nSymbols; ++i) {
|
||||
monitor.increment();
|
||||
int symbolIndex = indirectSymbols.get(i);
|
||||
NList symbol = symbolTableCommand.getSymbolAt(symbolIndex);
|
||||
NList symbol =
|
||||
symbolTableCommand != null ? symbolTableCommand.getSymbolAt(symbolIndex) : null;
|
||||
String name = null;
|
||||
if (symbol != null && !symbol.getString().isBlank()) {
|
||||
name = SymbolUtilities.replaceInvalidChars(symbol.getString(), true);
|
||||
|
||||
Reference in New Issue
Block a user