mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-22 07:53:50 +08:00
Merge remote-tracking branch 'origin/GT-1-dragonmacher-npe-action-fix'
This commit is contained in:
+12
-4
@@ -112,8 +112,7 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
|
||||
ClangNode parent = tokenAtCursor.Parent();
|
||||
if (parent instanceof ClangStatement) {
|
||||
PcodeOp op = ((ClangStatement) parent).getPcodeOp();
|
||||
int opCode = op.getOpcode();
|
||||
if (opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND) {
|
||||
if (isCallOp(op)) {
|
||||
return op;
|
||||
}
|
||||
}
|
||||
@@ -141,8 +140,7 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
|
||||
Iterator<PcodeOpAST> iter = hfunc.getPcodeOps(addr);
|
||||
while (iter.hasNext()) {
|
||||
PcodeOpAST op = iter.next();
|
||||
int opCode = op.getOpcode();
|
||||
if (opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND) {
|
||||
if (isCallOp(op)) {
|
||||
return op;
|
||||
}
|
||||
}
|
||||
@@ -150,6 +148,16 @@ public class OverridePrototypeAction extends AbstractDecompilerAction {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isCallOp(PcodeOp op) {
|
||||
|
||||
if (op == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int opCode = op.getOpcode();
|
||||
return opCode == PcodeOp.CALL || opCode == PcodeOp.CALLIND;
|
||||
}
|
||||
|
||||
private Function getCalledFunction(Program program, PcodeOp op) {
|
||||
if (op.getOpcode() != PcodeOp.CALL) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user