summaryrefslogtreecommitdiff
path: root/libelf
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-05-08 17:56:32 +0200
committerMark Wielaard <mjw@redhat.com>2015-05-13 16:31:52 +0200
commita2b964c7dbbf54162b2c50931c172568fb4cfa70 (patch)
treee8c3061ff4e211b41701acd574360b729f3f6f9d /libelf
parentf0855403012fe34aee248353e4435d0b5c6576ef (diff)
downloadelfutils-a2b964c7dbbf54162b2c50931c172568fb4cfa70.tar.gz
Always call gelf_fsize with EV_CURRENT as argument.
Don't trust the elf version given by the file. It could be completely bogus. In which case gelf_fsize just returns zero. Which could cause divide by zero errors. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c34 Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf')
-rw-r--r--libelf/ChangeLog4
-rw-r--r--libelf/nlist.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index e9c2a8de..312d5cfb 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-08 Mark Wielaard <mjw@redhat.com>
+
+ * nlist.c (nlist): Call gelf_fsize with EV_CURRENT.
+
2015-01-03 Mark Wielaard <mjw@redhat.com>
* version_xlate.h (elf_cvt_Verdef): Use memmove to copy src to dest.
diff --git a/libelf/nlist.c b/libelf/nlist.c
index 41e5ff64..89fd0819 100644
--- a/libelf/nlist.c
+++ b/libelf/nlist.c
@@ -126,7 +126,7 @@ nlist (const char *filename, struct nlist *nl)
/* How many symbols are there? */
nsyms = (shdr->sh_size
- / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, data->d_version));
+ / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, EV_CURRENT));
/* Create the hash table. */
table = nlist_fshash_init (nsyms);