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

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