This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix invalid memory access in the BFD library's DWARF parser.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 13 Feb 2017 17:52:16 -0000
- Subject: [binutils-gdb] Fix invalid memory access in the BFD library's DWARF parser.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d11135f55294d75099ad03f81bacbe8ae93a6b28
commit d11135f55294d75099ad03f81bacbe8ae93a6b28
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Feb 13 17:51:27 2017 +0000
Fix invalid memory access in the BFD library's DWARF parser.
PR binutils/21151
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
unit length field.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/dwarf2.c | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f21d654..1c3d701 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-13 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21151
+ * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
+ unit length field.
+
2017-02-07 Andrew Waterman <andrew@sifive.com>
* elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 3699587..6b111d3 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4294,6 +4294,10 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
{
bfd_byte * new_ptr;
+ /* PR 21151 */
+ if (stash->info_ptr + length > stash->info_ptr_end)
+ return FALSE;
+
each = parse_comp_unit (stash, length, info_ptr_unit,
offset_size);
if (!each)