summaryrefslogtreecommitdiff
path: root/plugins/elf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-24 08:14:00 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-24 08:14:00 (GMT)
commite441c2320666df295eaecc385740f40acbd2afbe (patch)
tree153200860196808bd9dda74c5bb7292cd69d3757 /plugins/elf
parent337fa0e661abfa999e2b2dbd8161227933220ee3 (diff)
Handled null virtual addresses with more care.
Diffstat (limited to 'plugins/elf')
-rw-r--r--plugins/elf/section.c22
1 files changed, 21 insertions, 1 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);