pcode-graph 3.0.1__py3-none-any.whl → 3.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pcode_graph/simplifier.py CHANGED
@@ -13,6 +13,9 @@ from pathlib import Path
13
13
 
14
14
 
15
15
  class GraphSimplifier:
16
+ """This simplifier is built to work with flat CFG, Basic Block nodes
17
+ and Membership edges are not taken into account.
18
+ """
16
19
 
17
20
  def __init__(
18
21
  self,
@@ -64,27 +67,23 @@ class GraphSimplifier:
64
67
  self.graph.nodes[index].kind == NodeKinds.Phi and len(set(data_preds)) == 1
65
68
  ), "More than one data predecessor to the node to remove"
66
69
 
67
- for i, e in enumerate(self.graph.edges):
68
- if e is None:
69
- continue
70
- remove = False
71
- if e.source_node == index:
72
- if e.kind == EdgeKinds.Data:
73
- self._proxy[e.source_node].out_edge_indexes.remove(i)
74
- e.source_node = data_preds[0]
75
- self._proxy[e.source_node].out_edge_indexes.append(i)
76
- else:
77
- remove = True
78
-
79
- if e.destination_node == index:
80
- if e.kind == EdgeKinds.Control:
81
- self._proxy[e.destination_node].in_edge_indexes.remove(i)
82
- e.destination_node = control_succs[0]
83
- self._proxy[e.destination_node].in_edge_indexes.append(i)
84
- else:
85
- remove = True
86
-
87
- if remove:
70
+
71
+ for i in list(proxy.out_edge_indexes):
72
+ e = self.graph.edges[i]
73
+ if e.kind == EdgeKinds.Data:
74
+ self._proxy[e.source_node].out_edge_indexes.remove(i)
75
+ e.source_node = data_preds[0]
76
+ self._proxy[e.source_node].out_edge_indexes.append(i)
77
+ else:
78
+ self._remove_edge(i)
79
+
80
+ for i in list(proxy.in_edge_indexes):
81
+ e = self.graph.edges[i]
82
+ if e.kind == EdgeKinds.Control:
83
+ self._proxy[e.destination_node].in_edge_indexes.remove(i)
84
+ e.destination_node = control_succs[0]
85
+ self._proxy[e.destination_node].in_edge_indexes.append(i)
86
+ else:
88
87
  self._remove_edge(i)
89
88
 
90
89
  # Patch the graph
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pcode_graph
3
- Version: 3.0.1
3
+ Version: 3.0.2
4
4
  Summary: Build, display and vectorize semantic graphs from binary code
5
5
  Project-URL: Homepage, https://github.com/quarkslab/pcode_graph
6
6
  Project-URL: Issues, https://github.com/quarkslab/pcode_graph/issues
@@ -18,13 +18,13 @@ pcode_graph/memory.py,sha256=5SdPZF3XajdWNv0iS0PLOLjCsn2eQpLV8BV9wkqxVxY,10269
18
18
  pcode_graph/nx_exporter.py,sha256=lSczsuuyD9XNE_8PgqCEvPdbMMXSdKLLt6YNPsGF-Zk,629
19
19
  pcode_graph/pcode.py,sha256=OPLZriOUUBHOlolvgCPYJO8CXg7rcUjyoorTZO8lebw,4593
20
20
  pcode_graph/registers.py,sha256=Grw4Ypr8GldG5nR1YeDG4rMf13gvzugSngvq2y51xjk,58328
21
- pcode_graph/simplifier.py,sha256=NAnPcfJi9XfwZ6VADc02S64tsR0fSH7cs7PZ3mP5WZk,6730
21
+ pcode_graph/simplifier.py,sha256=4aD6RJ5hhSqV8mI3ACjDWAzmUXRVO83UytZ9L-sINys,6761
22
22
  pcode_graph/torch_utils.py,sha256=GwVjWKL5Lqhm94b69o-rCilzNRu237gyJo6T6xWQHQc,966
23
23
  pcode_graph/translator.py,sha256=h90ay8VnCsgWRpK9fcYa0iu6CKXY0YDKl8CtH_gIx3U,7619
24
24
  pcode_graph/view.py,sha256=UybFV8xSDTJdqzzqop-U-90qnyKxiO5q_5B1Ef8DaiQ,2501
25
25
  pcode_graph/visitor.py,sha256=bxaQ9q0lTw8ysPOrta5G7LeHZYnq3IBxMafM_-8FruM,6990
26
- pcode_graph-3.0.1.dist-info/METADATA,sha256=Os-OLNztxptmi6MWu939Kj6o0ZSsv_KpBwJlb5J8Ano,6568
27
- pcode_graph-3.0.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
28
- pcode_graph-3.0.1.dist-info/entry_points.txt,sha256=7pTTgqjYSRYwmBdA0GwJYXPfOmdk8I_mGsJOHHx-PXQ,45
29
- pcode_graph-3.0.1.dist-info/licenses/LICENSE,sha256=iVkUrjpGBX_59jOK6a7mKkvjHUCGfiCFQRgrziEh-nY,1066
30
- pcode_graph-3.0.1.dist-info/RECORD,,
26
+ pcode_graph-3.0.2.dist-info/METADATA,sha256=4_-k8Ej68qibPcLitfA2EMMdsrUYLKoZ9KxCEmUh72M,6568
27
+ pcode_graph-3.0.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
28
+ pcode_graph-3.0.2.dist-info/entry_points.txt,sha256=7pTTgqjYSRYwmBdA0GwJYXPfOmdk8I_mGsJOHHx-PXQ,45
29
+ pcode_graph-3.0.2.dist-info/licenses/LICENSE,sha256=iVkUrjpGBX_59jOK6a7mKkvjHUCGfiCFQRgrziEh-nY,1066
30
+ pcode_graph-3.0.2.dist-info/RECORD,,