This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_29-branch] Prevent an address violation parsing corrupt DWARF information by fixing the test for an overlong de
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Sep 2017 10:23:02 -0000
- Subject: [binutils-gdb/binutils-2_29-branch] Prevent an address violation parsing corrupt DWARF information by fixing the test for an overlong de
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6bdd6269844b3dd73dd57f9d361c0bebe7f2778a
commit 6bdd6269844b3dd73dd57f9d361c0bebe7f2778a
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Sep 1 11:22:43 2017 +0100
Prevent an address violation parsing corrupt DWARF information by fixing the test for an overlong debug line info structure.
PR 22059
* dwarf2.c (decode_line_info): Fix test for an overlong line info
structure.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/dwarf2.c | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8db7080..ce926fe 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2017-09-01 Nick Clifton <nickc@redhat.com>
+ PR 22059
+ * dwarf2.c (decode_line_info): Fix test for an overlong line info
+ structure.
+
+2017-09-01 Nick Clifton <nickc@redhat.com>
+
PR 21933
PR 22060
* elf.c (elf_read_notes): Check for a note size of -1.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 04a2585..8779627 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2073,12 +2073,12 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
offset_size = 8;
}
- if (lh.total_length > stash->dwarf_line_size)
+ if (unit->line_offset + lh.total_length > stash->dwarf_line_size)
{
_bfd_error_handler
/* xgettext: c-format */
- (_("Dwarf Error: Line info data is bigger (0x%lx) than the section (0x%lx)"),
- (long) lh.total_length, (long) stash->dwarf_line_size);
+ (_("Dwarf Error: Line info data is bigger (%#Lx) than the space remaining in the section (%#Lx)"),
+ lh.total_length, stash->dwarf_line_size - unit->line_offset);
bfd_set_error (bfd_error_bad_value);
return NULL;
}