mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 00:36:49 +08:00
GP-4883 fix null exception in PropagateExternalParamsScript
This commit is contained in:
@@ -31,6 +31,8 @@ import ghidra.program.model.symbol.*;
|
||||
public class PropagateExternalParametersScript extends GhidraScript {
|
||||
private List<PushedParamInfo> results = new ArrayList<>();
|
||||
|
||||
private static final boolean PRINT_OPTYPE = false;
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Listing listing = currentProgram.getListing();
|
||||
@@ -149,7 +151,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||
Address thunkRefAddr = thunkRef.getFromAddress();
|
||||
|
||||
CodeUnit cu = listing.getCodeUnitAt(thunkRefAddr);
|
||||
if(cu == null) {
|
||||
if (cu == null) {
|
||||
// println("Referenced CodeUnit is null: " + thunkRefAddr);
|
||||
continue;
|
||||
}
|
||||
@@ -300,10 +302,18 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||
numSkips--;
|
||||
}
|
||||
else {
|
||||
|
||||
// if option is true add the value of the optype to the EOL comment
|
||||
String opType = "";
|
||||
if (PRINT_OPTYPE) {
|
||||
opType = " " + toHexString(currentProgram.getListing()
|
||||
.getInstructionAt(cu.getMinAddress())
|
||||
.getOperandType(0),
|
||||
false, true);
|
||||
}
|
||||
setEOLComment(cu.getMinAddress(), params[index].getDataType().getDisplayName() +
|
||||
" " + params[index].getName() + " for " + extFuncName);
|
||||
// add the following to the EOL comment to see the value of the optype
|
||||
// + " | " + ghidra.program.model.lang.OperandType.toString(currentProgram.getListing().getInstructionAt(cu.getMinAddress()).getOperandType(0))
|
||||
" " + params[index].getName() + " for " + extFuncName + opType);
|
||||
|
||||
addResult(params[index].getName(), params[index].getDataType(),
|
||||
cu.getMinAddress(), extFuncName);
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user