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>
diff --git a/src/nm.c b/src/nm.c
index 7d20bbb..8d19715 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -1166,7 +1166,7 @@
/* Consistency checks. */
if (entsize == 0
- || entsize != gelf_fsize (ebl->elf, ELF_T_SYM, 1, ehdr->e_version))
+ || entsize != gelf_fsize (ebl->elf, ELF_T_SYM, 1, EV_CURRENT))
error (0, 0,
gettext ("%s: entry size in section %zd `%s' is not what we expect"),
fullname, elf_ndxscn (scn),