summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/elf/section.c22
-rw-r--r--src/glibext/gbinportion.c9
2 files changed, 27 insertions, 4 deletions
diff --git a/plugins/elf/section.c b/plugins/elf/section.c
index 0e2fd3e..0758693 100644
--- a/plugins/elf/section.c
+++ b/plugins/elf/section.c
@@ -202,8 +202,21 @@ void get_elf_section_content(const GElfFormat *format, const elf_shdr *section,
*size = ELF_SHDR(format, *section, sh_size);
if (addr != NULL)
+ {
*addr = ELF_SHDR(format, *section, sh_addr);
+ if (*addr == 0)
+ {
+ if (ELF_HDR(format, format->header, e_type) == ET_REL
+ || (ELF_SHDR(format, *section, sh_flags) & SHF_ALLOC) == 0)
+ {
+ *addr = VMPA_NO_VIRTUAL;
+ }
+
+ }
+
+ }
+
}
@@ -229,7 +242,14 @@ void get_elf_section_range(const GElfFormat *format, const elf_shdr *section, mr
virt = ELF_SHDR(format, *section, sh_addr);
if (virt == 0)
- virt = VMPA_NO_VIRTUAL;
+ {
+ if (ELF_HDR(format, format->header, e_type) == ET_REL
+ || (ELF_SHDR(format, *section, sh_flags) & SHF_ALLOC) == 0)
+ {
+ virt = VMPA_NO_VIRTUAL;
+ }
+
+ }
init_vmpa(&tmp, ELF_SHDR(format, *section, sh_offset), virt);
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index ab5fa6e..ff5ff7d 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -1216,14 +1216,17 @@ GBinPortion *g_binary_portion_find_at_pos(GBinPortion *portion, gint x, GdkRecta
static bool g_binary_portion_contains_vmpa(const GBinPortion *portion, const vmpa2t *addr)
{
bool result; /* Bilan à retourner */
+ const mrange_t *range; /* Emplacement de portion */
result = false;
- /* Portion non allouée en mémoire -> adresse nulle ; on écarte */
- if (get_virt_addr(get_mrange_addr(&portion->range)) == 0)
+ range = g_binary_portion_get_range(portion);
+
+ /* Portion non allouée en mémoire : on écarte */
+ if (!has_virt_addr(get_mrange_addr(range)))
goto not_found;
- result = mrange_contains_addr(&portion->range, addr);
+ result = mrange_contains_addr(range, addr);
not_found: