Replace a couple of assertions in the BFD library that can be triggered by attempts...
authorNick Clifton <nickc@redhat.com>
Tue, 17 Mar 2020 17:02:15 +0000 (17:02 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 17 Mar 2020 17:02:15 +0000 (17:02 +0000)
PR 25633
* elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
with error messages.

bfd/ChangeLog
bfd/elf.c
gas/ChangeLog
opcodes/ChangeLog

index 515ab02bf503a12972fcc0372c5b761ac05b6396..461ce208d665c96438b4b8daa99c7f7e1b8cb129 100644 (file)
@@ -1,3 +1,9 @@
+2020-03-17  Nick Clifton  <nickc@redhat.com>
+
+       PR 25633
+       * elf.c (_bfd_elf_copy_special_section_fields): Replace assertions
+       with error messages.
+
 2020-03-17  Nick Clifton  <nickc@redhat.com>
 
        PR 25687
index 2a299f15f00454b13e349fb0d94bade412bb48f0..6aaa96f83f6228d535138164b4e55d950402ef74 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -12592,13 +12592,31 @@ _bfd_elf_copy_special_section_fields (const bfd *   ibfd ATTRIBUTE_UNUSED,
     }
 
   /* Find the output section that corresponds to the isection's sh_info link.  */
-  BFD_ASSERT (isection->sh_info > 0
-             && isection->sh_info < elf_numsections (ibfd));
+  if (isection->sh_info == 0
+      || isection->sh_info >= elf_numsections (ibfd))
+    {
+      _bfd_error_handler
+       /* xgettext:c-format */
+       (_("%pB(%pA): info section index is invalid"),
+       obfd, osec);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
   isection = elf_elfsections (ibfd)[isection->sh_info];
 
-  BFD_ASSERT (isection != NULL);
-  BFD_ASSERT (isection->bfd_section != NULL);
-  BFD_ASSERT (isection->bfd_section->output_section != NULL);
+  if (isection == NULL
+      || isection->bfd_section == NULL
+      || isection->bfd_section->output_section == NULL)
+    {
+      _bfd_error_handler
+       /* xgettext:c-format */
+       (_("%pB(%pA): info section index cannot be set because the section is not in the output"),
+       obfd, osec);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
   osection->sh_info =
     elf_section_data (isection->bfd_section->output_section)->this_idx;
 
index 8bc4b3aa96810bd932b2cb62dcd75c64f9bcf119..026336220effd180838b67af9183022f883db09e 100644 (file)
@@ -1,3 +1,28 @@
+2020-03-17  Sergey Belyashov  <sergey.belyashov@gmail.com>
+
+       PR 25641
+       PR 25668
+       PR 25633
+       Fix disassembling ED+A4/AC/B4/BC opcodes.
+       Fix assembling lines containing colonless label and instruction
+       with first operand inside parentheses.
+       Fix registration of unsupported by target CPU registers.
+       * config/tc-z80.c: See above.
+       * config/tc-z80.h: See above.
+       * testsuite/gas/z80/colonless.d: Update test.
+       * testsuite/gas/z80/colonless.s: Likewise.
+       * testsuite/gas/z80/ez80_adl_all.d: Likewise.
+       * testsuite/gas/z80/ez80_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/ez80_z80_all.d: Likewise.
+       * testsuite/gas/z80/gbz80_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/r800_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/unsup_regs.s: Likewise.
+       * testsuite/gas/z80/z180_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/z80.exp: Likewise.
+       * testsuite/gas/z80/z80_strict_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/z80_unsup_regs.d: Likewise.
+       * testsuite/gas/z80/z80n_unsup_regs.d: Likewise.
+
 2020-03-13  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        PR 25660
index 3be58d5abc5b8e5646fa963cfb6295d3d3f40cde..3e947367e21247330693ce9cd986d1a4e9dd12a8 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-17  Sergey Belyashov  <sergey.belyashov@gmail.com>
+
+       PR 25641
+       * z80-dis.c: Fix disassembling ED+A4/AC/B4/BC opcodes.
+
 2020-03-13  Jan Beulich  <jbeulich@suse.com>
 
        * i386-dis.c (X86_64_0D): Rename to ...