From 1aa9ba33144b37ae96859573699a80adde93e509 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 14 Jan 2017 16:49:16 +0100
Subject: Fixed a bug about pure comments containing code.

---
 ChangeLog                       | 8 ++++++++
 src/analysis/db/items/comment.c | 2 ++
 src/glibext/gbinportion.c       | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 7599fa5..82d5060 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+17-01-15  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/analysis/db/items/comment.c:
+	Match the perfect line index.
+
+	* src/glibext/gbinportion.c:
+	Fix a bug about pure comments containing code.
+
 17-01-14  Cyrille Bagard <nocbos@gmail.com>
 
 	* src/arch/vmpa.c:
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c
index 936e2ac..c021e44 100644
--- a/src/analysis/db/items/comment.c
+++ b/src/analysis/db/items/comment.c
@@ -658,6 +658,8 @@ static bool g_db_comment_run(GDbComment *comment, GLoadedBinary *binary, bool ap
                 linked = g_buffer_cache_find_index_by_addr(cache, get_mrange_addr(range), true);
                 assert(linked != g_buffer_cache_count_lines(cache));
 
+                linked = g_buffer_cache_look_for_flag(cache, linked, BLF_HAS_CODE | BLF_IS_LABEL);
+
                 RUN_INLINED_COMMENT(linked, comment, comment->old_inlined[i]);
 
             }
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index e5dedd6..a28f1a7 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -869,7 +869,7 @@ static int g_binary_portion_contains_addr(const GBinPortion *portion, const vmpa
 
 static BufferLineFlags g_binary_portion_get_flags(const GBinPortion *portion, size_t index, size_t repeat)
 {
-    return (repeat == 0 ? BLF_WIDTH_MANAGER : BLF_HAS_CODE);
+    return (repeat == 0 ? BLF_WIDTH_MANAGER : BLF_NONE);
 
 }
 
-- 
cgit v0.11.2-87-g4458