Ghidra is a software reverse engineering (SRE) framework
GP-3518 Additional double precision checks
caheckman603cf5523f52
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/double.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/double.ccindex 8eb11963ef..49dd39f4ea 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/double.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/double.cc@@ -787,10 +787,14 @@ bool SplitVarnode::isAddrTiedContiguous(Varnode *lo,Varnode *hi,Address &res)if (!hi->isAddrTied()) return false;// Make sure there is no explicit symbol that would prevent the pieces from being joined- SymbolEntry *entry = lo->getSymbolEntry();- if ((entry != (SymbolEntry *)0)&&(entry->getOffset()==0)) return false;- entry = hi->getSymbolEntry();- if ((entry != (SymbolEntry *)0)&&(entry->getOffset()==0)) return false;+ SymbolEntry *entryLo = lo->getSymbolEntry();+ SymbolEntry *entryHi = hi->getSymbolEntry();+ if (entryLo != (SymbolEntry *)0 || entryHi != (SymbolEntry *)0) {+ if (entryLo == (SymbolEntry *)0 || entryHi == (SymbolEntry *)0)+ return false; // One is marked with a symbol, the other is not+ if (entryLo->getSymbol() != entryHi->getSymbol())+ return false; // They are part of different symbols+ }AddrSpace *spc = lo->getSpace();if (spc != hi->getSpace()) return false;uintb looffset = lo->getOffset();@@ -3093,6 +3097,12 @@ bool IndirectForm::verify(Varnode *h,Varnode *l,PcodeOp *ind)if (affector != PcodeOp::getOpFromConst(indlo->getIn(1)->getAddr())) continue; // hi and lo must be affected by same opreslo = indlo->getOut();if (reslo->getSpace()->getType() == IPTR_INTERNAL) return false; // Indirect must not be through a temporary+ if (reslo->isAddrTied() || reshi->isAddrTied()) {+ Address addr;+ // If one piece is address tied, the other must be as well, and they must fit together as contiguous whole+ if (!SplitVarnode::isAddrTiedContiguous(reslo, reshi, addr))+ return false;+ }return true;}return false;diff --git a/Ghidra/Features/Decompiler/src/decompile/datatests/partialunion.xml b/Ghidra/Features/Decompiler/src/decompile/datatests/partialunion.xmlindex 489cba0888..55c9e55e7f 100644--- a/Ghidra/Features/Decompiler/src/decompile/datatests/partialunion.xml+++ b/Ghidra/Features/Decompiler/src/decompile/datatests/partialunion.xml@@ -33,7 +33,7 @@<com>dec</com><com>print C</com><com>lo fu partial1</com>- <com>map unionfacet structunion 1 r0x1006ee 20603f6a8a0b89</com>+ <com>map unionfacet structunion 1 r0x1006ee 10603f2c20ffa6</com><com>dec</com><com>print C</com><com>quit</com>