summaryrefslogtreecommitdiffstats
path: root/libdwfl/dwfl_segment_report_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/dwfl_segment_report_module.c')
-rw-r--r--libdwfl/dwfl_segment_report_module.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index cd8f6135..5125decf 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -367,6 +367,11 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
phentsize = ehdr.e32.e_phentsize;
if (phentsize != sizeof (Elf32_Phdr))
return finish ();
+ /* NOTE if the number of sections is > 0xff00 then e_shnum
+ is zero and the actual number would come from the section
+ zero sh_size field. We ignore this here because getting shdrs
+ is just a nice bonus (see below in consider_phdr PT_LOAD
+ where we trim the last segment). */
shdrs_end = ehdr.e32.e_shoff + ehdr.e32.e_shnum * ehdr.e32.e_shentsize;
break;
@@ -380,6 +385,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name,
phentsize = ehdr.e64.e_phentsize;
if (phentsize != sizeof (Elf64_Phdr))
return finish ();
+ /* See the NOTE above for shdrs_end and ehdr.e32.e_shnum. */
shdrs_end = ehdr.e64.e_shoff + ehdr.e64.e_shnum * ehdr.e64.e_shentsize;
break;