summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-31 20:50:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-31 20:50:15 (GMT)
commitc6bfb7dd499f2aa1d4fb4f39dc3f49cb8801fed2 (patch)
tree748784ea34f532396bc5ff7a12bf792c6dd1e14c /src/analysis/disass
parent3d4d97da355c0dd90b1e623f452da22894f8cd71 (diff)
Improved loop detection.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/loop.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c
index c37c7f6..b001992 100644
--- a/src/analysis/disass/loop.c
+++ b/src/analysis/disass/loop.c
@@ -409,7 +409,15 @@ static void define_basic_blocks_loops(GBlockList *list, bblock_info_t *info)
links = get_block_predecessors(block, info, &count);
for (k = 0; k < count; k++)
- if (should_be_natural_loop_link(iter->iloop_header, links[k].info->iloop_header))
+ if (should_be_natural_loop_link(iter->iloop_header, links[k].info->iloop_header)
+ /**
+ * Il se peut qu'un bloc fasse référence à lui même !
+ *
+ * Cf. tests/analysis/disass/jinit_color_converter.bin
+ *
+ * On évite ici une boucle sans fin en officialisant cette boucle.
+ */
+ || links[k].info == iter->iloop_header)
{
g_basic_block_get_boundaries(G_BASIC_BLOCK(links[k].linked), NULL, &last);
g_basic_block_get_boundaries(G_BASIC_BLOCK(block), &first, NULL);