]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix assertion failure in the BFD library when called to parse a file containing corru...
authorNick Clifton <nickc@redhat.com>
Thu, 19 Mar 2020 14:40:00 +0000 (14:40 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 19 Mar 2020 14:40:00 +0000 (14:40 +0000)
PR 25699
* elf.c (bfd_elf_set_group_contents): Replace assertion with an
error return.

bfd/ChangeLog
bfd/elf.c

index 44b18d87f97b807dcc52a5359be8c4e9773e0bd9..1c2e1c789f063ff94a8f13e4bacb8ba6af48b421 100644 (file)
@@ -1,3 +1,9 @@
+2020-03-19  Nick Clifton  <nickc@redhat.com>
+
+       PR 25699
+       * elf.c (bfd_elf_set_group_contents): Replace assertion with an
+       error return.
+
 2020-03-19  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        * elfxx-riscv.c (riscv_parse_subset): Don't use C99.
index d182387ed4be6a1d1cb2bbe62d4cfaef5d84600e..6cbc389999d0c518379c20409333a55d1b0e10fc 100644 (file)
--- 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;