Blame SOURCES/elfutils-0.176-strip-symbols-illformed.patch

46be0c
commit f03ac75239e0981deaf4aa18f66f423bcc5ce051
46be0c
Author: Mark Wielaard <mark@klomp.org>
46be0c
Date:   Wed Mar 27 21:54:06 2019 +0100
46be0c
46be0c
    strip: Files with symbols referring to non-existing sections are illformed
46be0c
    
46be0c
    The check added in commit 4540ea98c "strip: Fix check test for SHN_XINDEX
46be0c
    symbol" was not complete. The (extended) section index should also exist.
46be0c
    If it doesn't exist, mark the file as illformed.
46be0c
    
46be0c
    https://sourceware.org/bugzilla/show_bug.cgi?id=24385
46be0c
    
46be0c
    Signed-off-by: Mark Wielaard <mark@klomp.org>
46be0c
46be0c
diff --git a/src/strip.c b/src/strip.c
46be0c
index a73009d9..4cd87506 100644
46be0c
--- a/src/strip.c
46be0c
+++ b/src/strip.c
46be0c
@@ -1975,6 +1975,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
46be0c
 				  && shndxdata->d_buf != NULL);
46be0c
 		    size_t sidx = (sym->st_shndx != SHN_XINDEX
46be0c
 				   ? sym->st_shndx : xshndx);
46be0c
+		    elf_assert (sidx < shnum);
46be0c
 		    sec = shdr_info[sidx].idx;
46be0c
 
46be0c
 		    if (sec != 0)