Skip to content

Ghidra is a software reverse engineering (SRE) framework

Handle TYPE_CODE in isPtrsubMatching

caheckman86f4daefc594
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
index e9d98b3774..4720263081 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
@@ -1329,11 +1329,15 @@ bool TypePointer::isPtrsubMatching(int8 off,int8 extra,int8 multiplier) const
return false;
}
}
- else if (ptrto->getMetatype() == TYPE_UNION) {
+ else if (meta == TYPE_UNION) {
// A PTRSUB reaching here cannot be used for a union field resolution
// These are created by ActionSetCasts::resolveUnion
return false; // So we always return false
}
+ else if (meta == TYPE_CODE) {
+ if (extra < 0)
+ return false;
+ }
else
return false; // Not a pointer to a structured data-type
return true;