summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);