This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] PR22201, DW_AT_name with out of bounds reference
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 25 Sep 2017 13:17:07 -0000
- Subject: [binutils-gdb] PR22201, DW_AT_name with out of bounds reference
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=11855d8a1f11b102a702ab76e95b22082cccf2f8
commit 11855d8a1f11b102a702ab76e95b22082cccf2f8
Author: Alan Modra <amodra@gmail.com>
Date: Mon Sep 25 19:46:34 2017 +0930
PR22201, DW_AT_name with out of bounds reference
DW_AT_name ought to always have a string value.
PR 22201
* dwarf2.c (scan_unit_for_symbols): Ignore DW_AT_name unless it
has string form.
(parse_comp_unit): Likewise.
Diff:
---
bfd/ChangeLog | 7 +++++++
bfd/dwarf2.c | 6 ++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index adbc014..ee286c4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
2017-09-25 Alan Modra <amodra@gmail.com>
+ PR 22201
+ * dwarf2.c (scan_unit_for_symbols): Ignore DW_AT_name unless it
+ has string form.
+ (parse_comp_unit): Likewise.
+
+2017-09-25 Alan Modra <amodra@gmail.com>
+
PR 22200
* dwarf2.c (read_formatted_entries): Error on format_count zero.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 8abb3f0..9ae5fba 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3225,7 +3225,8 @@ scan_unit_for_symbols (struct comp_unit *unit)
switch (attr.name)
{
case DW_AT_name:
- var->name = attr.u.str;
+ if (is_str_attr (attr.form))
+ var->name = attr.u.str;
break;
case DW_AT_decl_file:
@@ -3477,7 +3478,8 @@ parse_comp_unit (struct dwarf2_debug *stash,
break;
case DW_AT_name:
- unit->name = attr.u.str;
+ if (is_str_attr (attr.form))
+ unit->name = attr.u.str;
break;
case DW_AT_low_pc: