From c4b2f181c3d2ddc681ce42bf60bfa874e44b1cfe Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 8 Jun 2020 11:24:06 +0100 Subject: [PATCH] Fix an illegal memory access when parsing corrupt DWARF debug information. PR 26086 * dwarf.c (process_debug_info): Check that there is space in the debug_information array before filling in an entry. --- binutils/ChangeLog | 6 ++++++ binutils/dwarf.c | 1 + 2 files changed, 7 insertions(+) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ba3f6ad846d..36c6c713039 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2020-06-08 Nick Clifton + + 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 * doc/binutils.texi (PowerPC -M option): Mention power10 and pwr10. diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 598f8562abf..c2e73f72fe8 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -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; -- 2.30.2