* [COMMITTED] libdwfl: dwfl_module_getdwarf.c don't use symtab with bogus sh_entsize.
@ 2014-11-14 11:39 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-11-14 11:39 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]
Those will cause a divide by zero. We have no way to know what size the
entries are.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/dwfl_module_getdwarf.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 78314c4..22bc783 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-14 Mark Wielaard <mjw@redhat.com>
+
+ * dwfl_module_getdwarf.c (load_symtab): Don't use tables which have
+ a zero sh_entsize.
+
2014-11-10 Mark Wielaard <mjw@redhat.com>
* dwfl_module_getdwarf.c (find_dynsym): New inner function
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
index adb94b4..a20875b 100644
--- a/libdwfl/dwfl_module_getdwarf.c
+++ b/libdwfl/dwfl_module_getdwarf.c
@@ -575,6 +575,8 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
switch (shdr->sh_type)
{
case SHT_SYMTAB:
+ if (shdr->sh_entsize == 0)
+ break;
symtab = true;
*symscn = scn;
*symfile = file;
@@ -589,6 +591,8 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile,
if (symtab)
break;
/* Use this if need be, but keep looking for SHT_SYMTAB. */
+ if (shdr->sh_entsize == 0)
+ break;
*symscn = scn;
*symfile = file;
*strshndx = shdr->sh_link;
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-14 11:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 11:39 [COMMITTED] libdwfl: dwfl_module_getdwarf.c don't use symtab with bogus sh_entsize Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).