Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-3591 correct create function issue when entry point part of an existing function

ghidra1b1502f692a49
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateFunctionCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateFunctionCmd.java
index 0ab818fc98..4d2dd15f2d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateFunctionCmd.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateFunctionCmd.java
@@ -331,7 +331,7 @@ public class CreateFunctionCmd extends BackgroundCommand {
Map<Function, AddressSetView> bodyChangeMap = new HashMap<>();
// If I ain't got nobody left after extracting overlapping functions
- if (body.isEmpty()) {
+ if (body.isEmpty() || !body.contains(entry)) {
// try subtracting this body from existing functions
// need to compute a bodyChangeMap if affecting other functions
// in case creation of this function fails