Ghidra is a software reverse engineering (SRE) framework
GP-5526 Correct CreateThunkCmd NPE
ghidra1cae8caac1436
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.javaindex 1743a23304..52278eb741 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java@@ -563,14 +563,15 @@ public class CreateThunkFunctionCmd extends BackgroundCommand<Program> {Listing listing = program.getListing();Instruction instr = listing.getInstructionAt(entry);- if (instr == null) {- return null;- }+// if there is no pcode, go to the next instruction// assume fallthrough (ie. x86 instruction ENDBR64)// TODO: at some point, might need to do a NOP detection- if (instr.getPcode().length == 0) {- instr = listing.getInstructionAfter(entry);+ while (instr != null && instr.getPcode().length == 0) {+ instr = listing.getInstructionAfter(instr.getAddress());+ }+ if (instr == null) {+ return null;}FlowType flowType;