Skip to content

Ghidra is a software reverse engineering (SRE) framework

Fix for TypeOpReturn::getInputLocal returning a type of the wrong size

caheckmanfb3908b3cca1
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc
index 670d94c9f7..a3b4612e87 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc
@@ -144,6 +144,8 @@ void Funcdata::startProcessing(void)
if (funcp.isInline())
warningHeader("This is an inlined function");
+ localmap->clearUnlocked();
+ funcp.clearUnlockedOutput();
Address baddr(baseaddr.getSpace(),0);
Address eaddr(baseaddr.getSpace(),~((uintb)0));
followFlow(baddr,eaddr);
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
index 028a316f9a..56ce320bc4 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/typeop.cc
@@ -815,7 +815,8 @@ Datatype *TypeOpReturn::getInputLocal(const PcodeOp *op,int4 slot) const
// if (!fp->isOutputLocked()) return TypeOp::getInputLocal(op,slot);
ct = fp->getOutputType();
- if (ct->getMetatype() == TYPE_VOID) return TypeOp::getInputLocal(op,slot);
+ if (ct->getMetatype() == TYPE_VOID || (ct->getSize() != op->getIn(slot)->getSize()))
+ return TypeOp::getInputLocal(op,slot);
return ct;
}