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

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