diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-08-16 21:52:02 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-08-16 21:52:02 (GMT) |
commit | ed763539951307353042c04af5c2278db0d05298 (patch) | |
tree | 6206d2fe355c6f3fc9526c4d37df5fb1ec55d182 /src/format/elf | |
parent | 13d12a85fa661c2f331a4ad61ef921d942ce9176 (diff) |
Ensured all registered binary portions are fully included in the file.
Diffstat (limited to 'src/format/elf')
-rw-r--r-- | src/format/elf/elf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c index 1ca81be..2ca3b8c 100644 --- a/src/format/elf/elf.c +++ b/src/format/elf/elf.c @@ -468,6 +468,7 @@ static void g_elf_format_refine_portions(GElfFormat *format) uint16_t max; /* Décompte d'éléments traités */ uint16_t i; /* Boucle de parcours */ off_t offset; /* Début de part de programme */ + vmpa2t origin; /* Origine d'une définition */ elf_phdr phdr; /* En-tête de programme ELF */ uint32_t p_flags; /* Droits associés à une partie*/ const char *background; /* Fond signigicatif */ @@ -506,6 +507,8 @@ static void g_elf_format_refine_portions(GElfFormat *format) offset = ELF_HDR(format, format->header, e_phoff) + ELF_HDR(format, format->header, e_phentsize) * i; + init_vmpa(&origin, offset, VMPA_NO_VIRTUAL); + if (!read_elf_program_header(format, offset, &phdr)) continue; @@ -535,7 +538,7 @@ static void g_elf_format_refine_portions(GElfFormat *format) g_binary_portion_set_rights(new, rights); - g_exe_format_include_portion(exe_format, new); + g_exe_format_include_portion(exe_format, new, &origin); } @@ -586,7 +589,12 @@ static void g_elf_format_refine_portions(GElfFormat *format) g_binary_portion_set_rights(new, rights); - g_exe_format_include_portion(exe_format, new); + offset = ELF_HDR(format, format->header, e_shoff) + + ELF_HDR(format, format->header, e_shentsize) * i; + + init_vmpa(&origin, offset, VMPA_NO_VIRTUAL); + + g_exe_format_include_portion(exe_format, new, &origin); } |