From 810de6edb44a18601d0a958be11e48252114d2ad Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 10 Jan 2016 17:37:58 +0100
Subject: Produced temporary code to handle routines without code.

---
 ChangeLog                   |  8 ++++++++
 src/analysis/disass/limit.c |  4 ++++
 src/analysis/disass/loop.c  |  4 ++++
 src/analysis/disass/macro.c |  5 +++++
 src/analysis/disass/rank.c  | 10 +++++++---
 5 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a6aa27c..61dd761 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 16-01-10  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/analysis/disass/limit.c:
+	* src/analysis/disass/loop.c:
+	* src/analysis/disass/macro.c:
+	* src/analysis/disass/rank.c:
+	Produce temporary code to handle routines without code.
+
+16-01-10  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/common/extstr.c:
 	Fix a bug when the replacing string contains the replaced pattern.
 
diff --git a/src/analysis/disass/limit.c b/src/analysis/disass/limit.c
index 6705e1d..dd99643 100644
--- a/src/analysis/disass/limit.c
+++ b/src/analysis/disass/limit.c
@@ -105,6 +105,10 @@ void limit_all_routines(GExeFormat *format, const GArchProcessor *proc, GBinRout
 
         start = g_arch_processor_find_instr_by_address(proc, &addr);
 
+
+        if (start == NULL) continue;
+
+
         g_arch_instruction_set_flag(start, AIF_ROUTINE_START);
 
         /* Si on peut se raccrocher à la routine suivante... */
diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c
index d9a3f2d..94916f7 100644
--- a/src/analysis/disass/loop.c
+++ b/src/analysis/disass/loop.c
@@ -472,6 +472,10 @@ static void track_loops_in_code(const GArchProcessor *proc, const instr_coverage
     size_t count;                           /* Taille de cette liste       */
 
     nodes = create_dragon_nodes(proc, coverage, range, start, &count);
+
+
+    if (nodes == NULL) return;
+
     assert(nodes != NULL);
 
     printf("nodes count :: %d\n", (int)count);
diff --git a/src/analysis/disass/macro.c b/src/analysis/disass/macro.c
index a9ae261..acb210a 100644
--- a/src/analysis/disass/macro.c
+++ b/src/analysis/disass/macro.c
@@ -1479,6 +1479,11 @@ void group_routines_instructions(GArchProcessor *proc, GBinRoutine **routines, s
         coverage = create_code_coverage(range);
 
         block = build_instruction_blocks(proc, coverage);
+
+
+        if (block == NULL) continue;
+
+
         g_binary_routine_set_basic_blocks(routines[i], block);
 
 
diff --git a/src/analysis/disass/rank.c b/src/analysis/disass/rank.c
index 758e15d..2ad1cdf 100644
--- a/src/analysis/disass/rank.c
+++ b/src/analysis/disass/rank.c
@@ -84,7 +84,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
             case ILT_EXEC_FLOW:
             case ILT_CATCH_EXCEPTION:
                 target = G_FLOW_BLOCK(g_instr_block_find_by_addr(list, get_mrange_addr(range), true));
-                assert(target != NULL);
+                //assert(target != NULL);
                 break;
 
             case ILT_JUMP:
@@ -106,7 +106,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
 
             case ILT_CASE_JUMP:
                 target = G_FLOW_BLOCK(g_instr_block_find_by_addr(links, get_mrange_addr(range), true));
-                assert(target != NULL);
+                //assert(target != NULL);
                 break;
 
             case ILT_JUMP_IF_TRUE:
@@ -150,7 +150,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
                 if (target == NULL)
                     target = G_FLOW_BLOCK(g_instr_block_find_by_addr(list, get_mrange_addr(range), true));
 
-                assert(target != NULL);
+                //assert(target != NULL);
 
                 break;
 
@@ -200,6 +200,10 @@ void rank_routines_blocks(GBinRoutine **routines, size_t count, GtkExtStatusBar
     {
         main_block = g_binary_routine_get_basic_blocks(routines[i]);
 
+
+        if (main_block == NULL) continue;
+
+
         g_instr_block_visit(main_block, (instr_block_visitor_cb)rank_flow_block, main_block);
 
 
-- 
cgit v0.11.2-87-g4458