Ghidra is a software reverse engineering (SRE) framework
Allow splitting of free varnodes
caheckmanbabc6d4d9b91
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.ccindex 4582e0e2e7..ea47bc12c0 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc@@ -523,6 +523,9 @@ bool Funcdata::fillinReadOnly(Varnode *vn)return false; // No change was made}+ if (vn->getSize() > sizeof(uintb))+ return false; // Constant will exceed precision+uintb res;uint1 bytes[32];try {diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.ccindex 46d7a299c3..29ddf2db8e 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc@@ -1937,18 +1937,21 @@ TransformVar *LaneDivide::setReplacement(Varnode *vn,int4 numLanes,int4 skipLanereturn newSplit(vn,description, numLanes, skipLanes);}- if (vn->isFree())- return (TransformVar *)0; // Abort+ // Allow free varnodes to be split+// if (vn->isFree())+// return (TransformVar *)0;if (vn->isTypeLock())return (TransformVar *)0;vn->setMark();TransformVar *res = newSplit(vn, description, numLanes, skipLanes);- workList.push_back(WorkNode());- workList.back().lanes = res;- workList.back().numLanes = numLanes;- workList.back().skipLanes = skipLanes;+ if (!vn->isFree()) {+ workList.push_back(WorkNode());+ workList.back().lanes = res;+ workList.back().numLanes = numLanes;+ workList.back().skipLanes = skipLanes;+ }return res;}