summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
Diffstat (limited to 'src/format')
-rw-r--r--src/format/elf/elf.c15
-rw-r--r--src/format/executable.c6
2 files changed, 11 insertions, 10 deletions
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c
index 4a56c52..64708ee 100644
--- a/src/format/elf/elf.c
+++ b/src/format/elf/elf.c
@@ -318,6 +318,7 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
const char *background; /* Fond signigicatif */
GBinPortion *new; /* Nouvelle portion définie */
char desc[MAX_PORTION_DESC]; /* Description d'une portion */
+ vmpa2t addr; /* Emplacement dans le binaire */
PortionAccessRights rights; /* Droits d'une portion */
elf_shdr strings; /* Section des descriptions */
bool has_strings; /* Section trouvée ? */
@@ -350,10 +351,8 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_desc(new, desc);
- g_binary_portion_set_values(new,
- ELF_PHDR(format, phdr, p_offset),
- ELF_PHDR(format, phdr, p_filesz),
- ELF_PHDR(format, phdr, p_vaddr));
+ init_vmpa(&addr, ELF_PHDR(format, phdr, p_offset), ELF_PHDR(format, phdr, p_vaddr));
+ g_binary_portion_set_values(new, &addr, ELF_PHDR(format, phdr, p_filesz));
rights = PAC_NONE;
if (p_flags & PF_R) rights |= PAC_READ;
@@ -398,6 +397,9 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_desc(new, desc);
+ init_vmpa(&addr, ELF_SHDR(format, section, sh_offset), ELF_SHDR(format, section, sh_addr));
+ g_binary_portion_set_values(new, &addr, ELF_SHDR(format, section, sh_size));
+
rights = PAC_NONE;
if (sh_flags & SHF_ALLOC) rights |= PAC_READ;
if (sh_flags & SHF_WRITE) rights |= PAC_WRITE;
@@ -405,11 +407,6 @@ static void g_elf_format_refine_portions(const GElfFormat *format, GBinPortion *
g_binary_portion_set_rights(new, rights);
- g_binary_portion_set_values(new,
- ELF_SHDR(format, section, sh_offset),
- ELF_SHDR(format, section, sh_size),
- ELF_SHDR(format, section, sh_addr));
-
g_binary_portion_include(raw, new);
}
diff --git a/src/format/executable.c b/src/format/executable.c
index f4c8739..6b39ac8 100644
--- a/src/format/executable.c
+++ b/src/format/executable.c
@@ -138,10 +138,14 @@ vmpa_t g_exe_format_get_entry_point(const GExeFormat *format)
GBinPortion *g_exe_format_get_portions(GExeFormat *format)
{
+ vmpa2t addr; /* Emplacement vide de sens */
+
if (format->portions == NULL)
{
format->portions = g_binary_portion_new(BPC_RAW);
- g_binary_portion_set_values(format->portions, 0, G_BIN_FORMAT(format)->length, 0);
+
+ init_vmpa(&addr, 0, VMPA_NO_VIRTUAL);
+ g_binary_portion_set_values(format->portions, &addr, G_BIN_FORMAT(format)->length);
if (format->refine_portions != NULL)
format->refine_portions(format, format->portions);