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

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