Ghidra is a software reverse engineering (SRE) framework
Check for null pointer when looking up endianess
caheckman97acbb7208eb
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.ccindex d0623559f9..780d102b5a 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc@@ -1997,8 +1997,10 @@ void PrintC::pushPartialSymbol(const Symbol *sym,int4 off,int4 sz,}else if (inslot >= 0) {Datatype *outtype = vn->getHigh()->getType();- if (castStrategy->isSubpieceCastEndian(outtype,ct,off,- sym->getFirstWholeMap()->getAddr().getSpace()->isBigEndian())) {+ AddrSpace *spc = sym->getFirstWholeMap()->getAddr().getSpace();+ if (spc == (AddrSpace *)0)+ spc = vn->getSpace();+ if (castStrategy->isSubpieceCastEndian(outtype,ct,off,spc->isBigEndian())) {// Treat truncation as SUBPIECE style castfinalcast = outtype;ct = (Datatype*)0;