Fix an illegal memory access when parsing corrupt DWARF debug information.
authorNick Clifton <nickc@redhat.com>
Mon, 8 Jun 2020 10:24:06 +0000 (11:24 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 8 Jun 2020 10:24:06 +0000 (11:24 +0100)
PR 26086
* dwarf.c (process_debug_info): Check that there is space in the
debug_information array before filling in an entry.

binutils/ChangeLog
binutils/dwarf.c

index ba3f6ad846dc03f90eec628e3a2215dbdf6cf77f..36c6c713039ad527a559c6b03bd07f5a0e0722f7 100644 (file)
@@ -1,3 +1,9 @@
+2020-06-08  Nick Clifton  <nickc@redhat.com>
+
+       PR 26086
+       * dwarf.c (process_debug_info): Check that there is space in the
+       debug_information array before filling in an entry.
+
 2020-06-06  Alan Modra  <amodra@gmail.com>
 
        * doc/binutils.texi (PowerPC -M option): Mention power10 and pwr10.
index 598f8562abf2bee8b8a9240ec3cf118f6ba12fc2..c2e73f72fe8495c395d68f666e0d8d3a8907b247 100644 (file)
@@ -3267,6 +3267,7 @@ process_debug_info (struct dwarf_section *           section,
 
       if ((do_loc || do_debug_loc || do_debug_ranges)
          && num_debug_info_entries == 0
+         && alloc_num_debug_info_entries > unit
          && ! do_types)
        {
          debug_information [unit].cu_offset = cu_offset;