summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-12-08 23:44:34 +0100
committerMark Wielaard <mark@klomp.org>2021-12-09 19:34:19 +0100
commit98e7adf70896ac179258d41c2aac38e9e91614bb (patch)
tree3f24480acdf00deb7a25235654680292abb60d3a /libdwfl
parentlibdwfl: Don't trust e_shentsize in dwfl_segment_report_module (diff)
downloadelfutils-98e7adf70896ac179258d41c2aac38e9e91614bb.tar.gz
elfutils-98e7adf70896ac179258d41c2aac38e9e91614bb.tar.bz2
elfutils-98e7adf70896ac179258d41c2aac38e9e91614bb.tar.xz
libdwfl: Don't install an Elf handle in a Dwfl_Module twice
dwfl_segment_report_module can be called with the same module name, start and end address twice (probably because of a corrupt core file). In that case don't override the main.elf handle if it already exists. https://sourceware.org/bugzilla/show_bug.cgi?id=28655 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/dwfl_segment_report_module.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 76e0899e..1f593ac9 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
12021-12-08 Mark Wielaard <mark@klomp.org> 12021-12-08 Mark Wielaard <mark@klomp.org>
2 2
3 * dwfl_segment_report_module.c (dwfl_segment_report_module): Check
4 Dwfl_Module isn't associated with an Elf before installing it.
5
62021-12-08 Mark Wielaard <mark@klomp.org>
7
3 * dwfl_segment_report_module.c (dwfl_segment_report_module): Don't 8 * dwfl_segment_report_module.c (dwfl_segment_report_module): Don't
4 trust e_shentsize. 9 trust e_shentsize.
5 10
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index be0aff76..f4acfe53 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -963,7 +963,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
963 elf->flags |= ELF_F_MALLOCED; 963 elf->flags |= ELF_F_MALLOCED;
964 } 964 }
965 965
966 if (elf != NULL) 966 if (elf != NULL && mod->main.elf == NULL)
967 { 967 {
968 /* Install the file in the module. */ 968 /* Install the file in the module. */
969 mod->main.elf = elf; 969 mod->main.elf = elf;