Ghidra is a software reverse engineering (SRE) framework
Do not apply rule ptrsubundo for pointers targeting ARM Thumb functions
Nicolas Iooss7cfdb503153c
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.ccindex f97146fa50..e9d98b3774 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc@@ -1287,10 +1287,18 @@ bool TypePointer::isPtrsubMatching(int8 off,int8 extra,int8 multiplier) constif (subType == (Datatype *)0 || newoff != 0)return false;extra = AddrSpace::addressToByteInt(extra,wordsize);- if (extra < 0 || extra >= subType->getSize()) {- if (!testForArraySlack(subType, extra))+ if (subType->getMetatype() == TYPE_CODE) {+ // When the pointer targets inside a function, consider PTRSUB to be suitable when+ // the extra is non-negative, as subType->getSize() cannot be used (it is always 1).+ if (extra < 0)return false;}+ else {+ if (extra < 0 || extra >= subType->getSize()) {+ if (!testForArraySlack(subType, extra))+ return false;+ }+ }}else if (meta == TYPE_ARRAY) {if (off != 0)