mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Fix null exception in PropagateExternalParametersScript.java
This commit is contained in:
parent
6a94f1f7ab
commit
0e558caa3d
1 changed files with 10 additions and 4 deletions
|
@ -134,8 +134,8 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
for (Reference extRef : extRefs) {
|
for (Reference extRef : extRefs) {
|
||||||
|
|
||||||
Address refAddr = extRef.getFromAddress();
|
Address refAddr = extRef.getFromAddress();
|
||||||
|
|
||||||
String refMnemonic = listing.getCodeUnitAt(refAddr).getMnemonicString();
|
String refMnemonic = listing.getCodeUnitAt(refAddr).getMnemonicString();
|
||||||
|
|
||||||
Function calledFromFunc = listing.getFunctionContaining(refAddr);
|
Function calledFromFunc = listing.getFunctionContaining(refAddr);
|
||||||
if (calledFromFunc == null) {
|
if (calledFromFunc == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -147,8 +147,14 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
while (tempIter.hasNext()) {
|
while (tempIter.hasNext()) {
|
||||||
Reference thunkRef = tempIter.next();
|
Reference thunkRef = tempIter.next();
|
||||||
Address thunkRefAddr = thunkRef.getFromAddress();
|
Address thunkRefAddr = thunkRef.getFromAddress();
|
||||||
String thunkRefMnemonic =
|
|
||||||
listing.getCodeUnitAt(thunkRefAddr).getMnemonicString();
|
CodeUnit cu = listing.getCodeUnitAt(thunkRefAddr);
|
||||||
|
if(cu == null) {
|
||||||
|
// println("Referenced CodeUnit is null: " + thunkRefAddr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String thunkRefMnemonic = cu.getMnemonicString();
|
||||||
|
|
||||||
Function thunkRefFunc = listing.getFunctionContaining(thunkRefAddr);
|
Function thunkRefFunc = listing.getFunctionContaining(thunkRefAddr);
|
||||||
if ((thunkRefMnemonic.equals(new String("CALL")) && (thunkRefFunc != null))) {
|
if ((thunkRefMnemonic.equals(new String("CALL")) && (thunkRefFunc != null))) {
|
||||||
CodeUnitIterator cuIt =
|
CodeUnitIterator cuIt =
|
||||||
|
@ -297,7 +303,7 @@ public class PropagateExternalParametersScript extends GhidraScript {
|
||||||
setEOLComment(cu.getMinAddress(), params[index].getDataType().getDisplayName() +
|
setEOLComment(cu.getMinAddress(), params[index].getDataType().getDisplayName() +
|
||||||
" " + params[index].getName() + " for " + extFuncName);
|
" " + params[index].getName() + " for " + extFuncName);
|
||||||
// add the following to the EOL comment to see the value of the optype
|
// add the following to the EOL comment to see the value of the optype
|
||||||
// +" " + toHexString(currentProgram.getListing().getInstructionAt(cu.getMinAddress()).getOperandType(0), false, true)
|
// + " | " + ghidra.program.model.lang.OperandType.toString(currentProgram.getListing().getInstructionAt(cu.getMinAddress()).getOperandType(0))
|
||||||
addResult(params[index].getName(), params[index].getDataType(),
|
addResult(params[index].getName(), params[index].getDataType(),
|
||||||
cu.getMinAddress(), extFuncName);
|
cu.getMinAddress(), extFuncName);
|
||||||
index++;
|
index++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue