mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-4582 Make sure newBlockMultiGoto preserves any self edge
This commit is contained in:
parent
e6112ce481
commit
464e33cf08
3 changed files with 38 additions and 16 deletions
|
@ -1674,13 +1674,20 @@ BlockMultiGoto *BlockGraph::newBlockMultiGoto(FlowBlock *bl,int4 outedge)
|
|||
}
|
||||
else {
|
||||
ret = new BlockMultiGoto(bl);
|
||||
int4 origSizeOut = bl->sizeOut();
|
||||
vector<FlowBlock *> nodes;
|
||||
nodes.push_back(bl);
|
||||
identifyInternal(ret,nodes);
|
||||
addBlock(ret);
|
||||
ret->addEdge(targetbl);
|
||||
if (targetbl != bl) // If the target is itself, edge is already removed by identifyInternal
|
||||
removeEdge(ret,targetbl);
|
||||
if (targetbl != bl) {
|
||||
if (ret->sizeOut() != origSizeOut) { // If there are less out edges after identifyInternal
|
||||
// it must have collapsed a self edge (switch out edges are already deduped)
|
||||
ret->forceOutputNum(ret->sizeOut()+1); // preserve the self edge (it is not the goto edge)
|
||||
}
|
||||
removeEdge(ret,targetbl); // Remove the edge to the goto target
|
||||
}
|
||||
// else -- the goto edge is a self edge and will get removed by identifyInternal
|
||||
if (isdefaultedge)
|
||||
ret->setDefaultGoto();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue