Ghidra is a software reverse engineering (SRE) framework
Fix for CommentSorter crash
caheckman0df9575f1b45
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/comment.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/comment.ccindex a51afda059..9cc74071b6 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/comment.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/comment.cc@@ -283,6 +283,8 @@ bool CommentSorter::findPosition(Subsort &subsort,Comment *comm,const Funcdata *if (opiter != fd->endOpAll()) { // If there is an op at or after the commentPcodeOp *op = (*opiter).second;BlockBasic *block = op->getParent();+ if (block == (BlockBasic *)0)+ throw LowlevelError("Dead op reaching CommentSorter");if (block->contains(comm->getAddr())) { // If the op's block contains the address// Associate comment with this opsubsort.setBlock(block->getIndex(), (uint4)op->getSeqNum().getOrder());@@ -295,6 +297,8 @@ bool CommentSorter::findPosition(Subsort &subsort,Comment *comm,const Funcdata *--opiter;PcodeOp *op = (*opiter).second;BlockBasic *block = op->getParent();+ if (block == (BlockBasic *)0)+ throw LowlevelError("Dead op reaching CommentSorter");if (block->contains(comm->getAddr())) { // If the op's block contains the address// Treat the comment as being in this block at the very endsubsort.setBlock(block->getIndex(),0xffffffff);diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.ccindex f8fb03b541..8745d36852 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc@@ -145,6 +145,7 @@ void Funcdata::stopProcessing(void){flags |= processing_complete;+ obank.destroyDead(); // Free up anything in the dead list#ifdef CPUI_STATISTICSglb->stats->process(*this);#endif