Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1554_emteere fix for looping on call-injections to the same location

emteere821f63c297b2
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/program/util/SymbolicPropogator.java b/Ghidra/Features/Base/src/main/java/ghidra/program/util/SymbolicPropogator.java
index f38e35bea2..a00a77a08b 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/program/util/SymbolicPropogator.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/program/util/SymbolicPropogator.java
@@ -778,6 +778,9 @@ public class SymbolicPropogator {
Msg.info(this, minInstrAddress + " " + instruction);
}
+ // callfixup injection targets that have already been used
+ HashSet<Address> previousInjectionTarget = new HashSet<>();
+
int mustClearAllUntil_PcodeIndex = -1;
// flag won't get set until there is something to clear
boolean mustClearAll = false;
@@ -941,12 +944,17 @@ public class SymbolicPropogator {
}
}
// check for pcode replacement - callfixup
- PcodeOp[] injectionPcode = checkForCallFixup(prog, func, instruction);
- if (injectionPcode != null && injectionPcode.length > 0) {
- ops = injectPcode(ops, pcodeIndex, injectionPcode);
- pcodeIndex = -1;
- injected = true;
- continue;
+ // don't re-inject to the same site.
+ if (!previousInjectionTarget.contains(target)) {
+ PcodeOp[] injectionPcode =
+ checkForCallFixup(prog, func, instruction);
+ if (injectionPcode != null && injectionPcode.length > 0) {
+ previousInjectionTarget.add(target);
+ ops = injectPcode(ops, pcodeIndex, injectionPcode);
+ pcodeIndex = -1;
+ injected = true;
+ continue;
+ }
}
}