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

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