From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from kwanyin.sergiodj.net (kwanyin.sergiodj.net [158.69.185.54]) by sourceware.org (Postfix) with ESMTPS id 74120385DC03 for ; Sat, 4 Apr 2020 01:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 74120385DC03 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] Fix assertion failure in the BFD library when called to parse a file containing corrupt ELF group information. From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <6a541707f341275fa5081ec36cc6f2551042c21e@gdb-build> Date: Fri, 03 Apr 2020 21:42:28 -0400 X-Spam-Status: No, score=-15.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-testers@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-testers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2020 01:42:33 -0000 *** TEST RESULTS FOR COMMIT 6a541707f341275fa5081ec36cc6f2551042c21e *** commit 6a541707f341275fa5081ec36cc6f2551042c21e Author: Nick Clifton AuthorDate: Thu Mar 19 14:40:00 2020 +0000 Commit: Nick Clifton CommitDate: Thu Mar 19 14:40:00 2020 +0000 Fix assertion failure in the BFD library when called to parse a file containing corrupt ELF group information. PR 25699 * elf.c (bfd_elf_set_group_contents): Replace assertion with an error return. diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 44b18d87f9..1c2e1c789f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-03-19 Nick Clifton + + PR 25699 + * elf.c (bfd_elf_set_group_contents): Replace assertion with an + error return. + 2020-03-19 Sebastian Huber * elfxx-riscv.c (riscv_parse_subset): Don't use C99. diff --git a/bfd/elf.c b/bfd/elf.c index d182387ed4..6cbc389999 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3533,8 +3533,13 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) if (symindx == 0) { /* If called from the assembler, swap_out_syms will have set up - elf_section_syms. */ - BFD_ASSERT (elf_section_syms (abfd) != NULL); + elf_section_syms. + PR 25699: A corrupt input file could contain bogus group info. */ + if (elf_section_syms (abfd) == NULL) + { + *failedptr = TRUE; + return; + } symindx = elf_section_syms (abfd)[sec->index]->udata.i; } elf_section_data (sec)->this_hdr.sh_info = symindx;