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

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