Blame SOURCES/elfutils-0.174-ar-sh_entsize-zero.patch

95a93d
commit 2b16a9be69939822dcafe075413468daac98b327
95a93d
Author: Mark Wielaard <mark@klomp.org>
95a93d
Date:   Thu Oct 18 19:01:52 2018 +0200
95a93d
95a93d
    arlib: Check that sh_entsize isn't zero.
95a93d
    
95a93d
    A bogus ELF file could have sh_entsize as zero. Don't divide by zero,
95a93d
    but just assume there are no symbols in the section.
95a93d
    
95a93d
    https://sourceware.org/bugzilla/show_bug.cgi?id=23786
95a93d
    
95a93d
    Signed-off-by: Mark Wielaard <mark@klomp.org>
95a93d
95a93d
diff --git a/src/arlib.c b/src/arlib.c
95a93d
index 778e087..a6521e3 100644
95a93d
--- a/src/arlib.c
95a93d
+++ b/src/arlib.c
95a93d
@@ -252,6 +252,9 @@ arlib_add_symbols (Elf *elf, const char *arfname, const char *membername,
95a93d
       if (data == NULL)
95a93d
 	continue;
95a93d
 
95a93d
+      if (shdr->sh_entsize == 0)
95a93d
+	continue;
95a93d
+
95a93d
       int nsyms = shdr->sh_size / shdr->sh_entsize;
95a93d
       for (int ndx = shdr->sh_info; ndx < nsyms; ++ndx)
95a93d
 	{