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

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