Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6495 Assign pointer submeta based on needsResolution

caheckman5f3598602490
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
index 2d48650e70..1050bd262a 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
@@ -1175,10 +1175,10 @@ void TypePointer::calcSubmeta(void)
{
type_metatype ptrtoMeta = ptrto->getMetatype();
if (ptrtoMeta == TYPE_STRUCT) {
- if (ptrto->numDepend() > 1 || ptrto->isIncomplete())
- submeta = SUB_PTR_STRUCT;
+ if (ptrto->needsResolution())
+ submeta = SUB_PTR; // Treat as a more generic pointer, allowing pointer to the component to take precedence
else
- submeta = SUB_PTR;
+ submeta = SUB_PTR_STRUCT;
}
else if (ptrtoMeta == TYPE_UNION) {
submeta = SUB_PTR_STRUCT;