Ghidra is a software reverse engineering (SRE) framework
Treat STORE based INDIRECT as artificial
caheckmanfeb2e6887bc8
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.ccindex 84b7855c20..0f07124895 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc@@ -487,8 +487,9 @@ void Heritage::findAddressForces(vector<PcodeOp *> ©Sinks,vector<PcodeOp *>if (newOp->isMark()) continue; // Already visited this opnewOp->setMark();OpCode opc = newOp->code();- bool isArtificial = (opc == CPUI_COPY || opc == CPUI_MULTIEQUAL);- if (isArtificial) {+ bool isArtificial = false;+ if (opc == CPUI_COPY || opc == CPUI_MULTIEQUAL) {+ isArtificial = true;int4 maxInNew = newOp->numInput();for(int4 j=0;j<maxInNew;++j) {Varnode *inVn = newOp->getIn(j);@@ -498,6 +499,12 @@ void Heritage::findAddressForces(vector<PcodeOp *> ©Sinks,vector<PcodeOp *>}}}+ else if (opc == CPUI_INDIRECT && newOp->isIndirectStore()) {+ // An INDIRECT can be considered artificial if it is caused by a STORE+ Varnode *inVn = newOp->getIn(0);+ if (addr == inVn->getAddr())+ isArtificial = true;+ }if (isArtificial)copySinks.push_back(newOp);else