Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6734 Keep HighEdge map symmetric

caheckmand4cdef264eb7
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc
index 36ff25468c..3c955754a9 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc
@@ -1121,8 +1121,11 @@ void HighIntersectTest::moveIntersectTests(HighVariable *high1,HighVariable *hig
iter = highedgemap.lower_bound( HighEdge(high1,(HighVariable *)0) );
while((iter!=highedgemap.end())&&((*iter).first.a == high1)) {
if (!(*iter).second) { // If test is intersection==false
- if (!(*iter).first.b->isMark()) // and there was no test with high2
- highedgemap.erase( iter++ ); // Delete the test
+ if (!(*iter).first.b->isMark()) { // and there was no test with high2
+ // Delete both edges of the test
+ highedgemap.erase( HighEdge( (*iter).first.b, (*iter).first.a) );
+ highedgemap.erase( iter++ );
+ }
else
++iter;
}