From ba1ec43a4a376d30db5daf69f24a563f615bc428 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 15 Jul 2017 12:30:30 +0200 Subject: Skipped out of bound routine when computing basic blocks. --- ChangeLog | 5 +++++ src/analysis/disass/routines.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 45bd2b8..0214e7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 17-07-15 Cyrille Bagard + * src/analysis/disass/routines.c: + Skip out of bound routine when computing basic blocks. + +17-07-15 Cyrille Bagard + * src/format/elf/elf.c: Typo. diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c index 5d6dc42..01a6e48 100644 --- a/src/analysis/disass/routines.c +++ b/src/analysis/disass/routines.c @@ -29,6 +29,7 @@ #include "loop.h" #include "rank.h" #include "../../glibext/delayed-int.h" +#include "../../gui/panels/log.h" @@ -305,6 +306,7 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, const mrange_t *range; /* Couverture d'une routine */ const vmpa2t *start; /* Adresse de départ */ const instr_coverage *coverage; /* Instructions couvertes */ + VMPA_BUFFER(loc); /* Position de la routine */ dragon_knight *knight; /* Complexité de code posée */ GBlockList *blocks; /* Liste de blocs basiques */ @@ -317,6 +319,24 @@ void g_routines_study_handle_blocks(GRoutinesStudy *study, GBinRoutine *routine, coverage = g_arch_processor_find_coverage_by_address(study->proc, start); + /** + * Si aucune couverture adaptée n'est trouvée, c'est que la routine ne se + * trouve probablement pas dans le corps du binaire... + * + * Erreur d'interprétation ou adresse fixe ? En tout cas, sans instructions, + * il n'y a aucun traitement possible ici ! + */ + if (coverage == NULL) + { + vmpa2_to_string(start, MDS_UNDEFINED, loc, NULL); + + log_variadic_message(LMT_BAD_BINARY, _("Skipped out of bound routine '%s' @ %s"), + g_binary_routine_get_name(routine), loc); + + return; + + } + knight = begin_dragon_knight(study->proc, coverage, range, start); -- cgit v0.11.2-87-g4458