Skip to content

Flowgraph API breaks on some graph patterns #2551

@plafosse

Description

@plafosse

Given the graph produced from the following code:

from binaryninja.enums import BranchType
from binaryninja.flowgraph import FlowGraph, FlowGraphNode
from binaryninja.interaction import show_graph_reportg = FlowGraph()
​
​
def node(name):
    n = FlowGraphNode(g)
    n.lines = [name]
    g.append(n)
    return n
​
​
def edge(a, b):
    a.add_outgoing_edge(BranchType.UnconditionalBranch, b)

g = FlowGraph()
node_D = node('D')
node_B = node('B')
node_C = node('C')
node_A = node('A')  # ROOT
edge(node_A, node_B)
edge(node_B, node_C)
edge(node_C, node_D)
edge(node_C, node_B)
edge(node_D, node_C)
show_graph_report("G", g)

Binary Ninja produces the following errors:

Node 2 was chosen in layout but it has no valid parent
Node 2 is not present in the layout data
Node 2 not processed in layout
Edge from 0 to 2 was not routed
Edge from 1 to 2 was not routed

Instead of this graph:
image

This graph is produced instead:
image

Metadata

Metadata

Assignees

Labels

Component: UIIssue needs changes to the user interfaceEffort: MediumIssues require < 1 month of workImpact: MediumIssue is impactful with a bad, or no, workaround

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions