summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-24 08:05:08 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-24 08:05:08 (GMT)
commit337fa0e661abfa999e2b2dbd8161227933220ee3 (patch)
treeb3b4ff362b98c268ad45285b572a3f7537cde0e9 /src/glibext
parent08c45a8c7970403c3d658b1b0af9ac09f66b4a7e (diff)
Fixed the trailing part address of multi-part portions.
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/gbinportion.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 27413f6..ab5fa6e 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -796,6 +796,7 @@ void g_binary_portion_include(GBinPortion *portion, GBinPortion *sub)
phys_t overlapping; /* Taille de la zone commune */
bool continued; /* Suite d'une découpe ? */
GBinPortion *left_part; /* Partie intégrable */
+ vmpa2t start; /* Départ de la seconde partie */
GBinPortion *right_part; /* Partie restante */
int g_binary_portion_is_included(const GBinPortion **a, const GBinPortion **b)
@@ -917,7 +918,17 @@ void g_binary_portion_include(GBinPortion *portion, GBinPortion *sub)
/* Partie qui déborde... */
- right_part = g_binary_portion_new(sub->code, &end, get_mrange_length(&sub->range) - overlapping);
+ /**
+ * Comme la portion incluante peut avoir une définition d'adresse
+ * virtuelle différente de celle de la portion incluse, on recalcule
+ * la position de départ de la seconde partie de la portion découpée
+ * à partir des données d'origine.
+ */
+
+ copy_vmpa(&start, get_mrange_addr(&sub->range));
+ advance_vmpa(&start, overlapping);
+
+ right_part = g_binary_portion_new(sub->code, &start, get_mrange_length(&sub->range) - overlapping);
if (!continued)
g_binary_portion_mark_as_continued(right_part, true);