Ghidra is a software reverse engineering (SRE) framework
Decompiler: keep the input of a wide INT_RIGHT consumed when the shift is 64 or more
FlashHitc3949d9e81d4
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.ccindex 5c575b8de4..a4e6a09e51 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc@@ -3963,6 +3963,12 @@ void ActionDeadCode::propagateConsumed(vector<Varnode *> &worklist)a = 0; // We know nothing about the low order consumption of the input bitselsea = outc << sa; // Most cases just do this+ if ((a==0)&&(outc!=0)&&(op->getIn(0)->getSize() > sizeof(uintb))) {+ // The consumed bits were shifted beyond the precision of the consume field,+ // but bits of the input above the field are still consumed+ a = ~((uintb)0);+ a = a ^ (a >> 1); // Set the highest bit possible in the mask to indicate some consumption+ }b = (outc == 0) ? 0 : ~((uintb)0);pushConsumed(a,op->getIn(0),worklist);pushConsumed(b,op->getIn(1),worklist);diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.ccindex c3da7329d2..e319f2ca3a 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc@@ -2350,7 +2350,8 @@ void PrintC::emitLocalVarDecls(const Funcdata *fd)enditer = fd->getScopeLocal()->childrenEnd();while(iter!=enditer) {Scope *l1 = (*iter).second;- if (emitScopeVarDecls(l1,Symbol::no_category))+ // Skip namespaces placed under the function (like switchD_...), their symbols are global+ if (!l1->isGlobal() && emitScopeVarDecls(l1,Symbol::no_category))notempty = true;++iter;}