Skip to content

Ghidra is a software reverse engineering (SRE) framework

Truncation amount was not expressed in bytes

caheckman38b72df2809c
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
index 42d1b44312..2384ad922b 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc
@@ -478,7 +478,7 @@ bool SubvariableFlow::traceForward(ReplaceVarnode *rvn)
newmask = (rvn->mask >> sa) & calc_mask(outvn->getSize());
if (newmask == 0) break; // subvar is set to zero, truncate flow
if (rvn->mask != (newmask << sa)) { // Some kind of truncation of the logical value
- if (flowsize > (sa + outvn->getSize()) && (rvn->mask & 1) != 0) {
+ if (flowsize > ((sa/8) + outvn->getSize()) && (rvn->mask & 1) != 0) {
// Only a piece of the logical value remains
addTerminalPatchSameOp(op, rvn, 0);
hcount += 1;