aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-06-08 11:24:06 +0100
committerNick Clifton <nickc@redhat.com>2020-06-08 11:24:06 +0100
commitc4b2f181c3d2ddc681ce42bf60bfa874e44b1cfe (patch)
tree95813f7860043bc95dba23e43ced6436e95f92eb /binutils/dwarf.c
parent9f3e7dbcbaa7d6dc86d04f40197d8d4331222222 (diff)
downloadgdb-c4b2f181c3d2ddc681ce42bf60bfa874e44b1cfe.zip
gdb-c4b2f181c3d2ddc681ce42bf60bfa874e44b1cfe.tar.gz
gdb-c4b2f181c3d2ddc681ce42bf60bfa874e44b1cfe.tar.bz2
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.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 598f856..c2e73f7 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;