Ghidra is a software reverse engineering (SRE) framework
GP-4133 Adjustment for forced indirect return
caheckman99d8762b9cf3
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.ccindex 839223ea14..b4d9509840 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc@@ -1512,13 +1512,12 @@ void ParamListStandardOut::assignMap(const PrototypePieces &proto,TypeFactory &tDatatype *pointertp = typefactory.getTypePointer(pointersize, proto.outtype, wordsize);if (responseCode == AssignAction::hiddenret_specialreg_void) {res.back().type = typefactory.getTypeVoid();- res.back().flags = 0;}else {if (assignAddressFallback(TYPECLASS_PTR,pointertp,false,status,res.back()) == AssignAction::fail)throw ParamUnassignedError("Cannot assign return value as a pointer");- res.back().flags = ParameterPieces::indirectstorage;}+ res.back().flags = ParameterPieces::indirectstorage;res.emplace_back(); // Add extra storage location in the input paramsres.back().type = pointertp; // that holds a pointer to where the return value should be storeddiff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ParameterPieces.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ParameterPieces.javaindex 40b314a2fe..c69dc68c59 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ParameterPieces.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/ParameterPieces.java@@ -92,18 +92,15 @@ public class ParameterPieces {VariableStorage store;try {if (joinPieces != null) {- store = new DynamicVariableStorage(program, false, joinPieces);+ store = new DynamicVariableStorage(program, isIndirect, joinPieces);}else {if (hiddenReturnPtr) {store = new DynamicVariableStorage(program,AutoParameterType.RETURN_STORAGE_PTR, address, sz);}- else if (isIndirect) {- store = new DynamicVariableStorage(program, true, address, sz);- }else {- store = new DynamicVariableStorage(program, false, address, sz);+ store = new DynamicVariableStorage(program, isIndirect, address, sz);}}}