aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-09-25 19:46:34 +0930
committerAlan Modra <amodra@gmail.com>2017-09-25 22:01:47 +0930
commit11855d8a1f11b102a702ab76e95b22082cccf2f8 (patch)
tree26a93462f025dbadab02761b3e28cdc0f2661de3 /bfd/dwarf2.c
parentc361faae8d964db951b7100cada4dcdc983df1bf (diff)
downloadfsf-binutils-gdb-11855d8a1f11b102a702ab76e95b22082cccf2f8.zip
fsf-binutils-gdb-11855d8a1f11b102a702ab76e95b22082cccf2f8.tar.gz
fsf-binutils-gdb-11855d8a1f11b102a702ab76e95b22082cccf2f8.tar.bz2
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.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c6
1 files changed, 4 insertions, 2 deletions
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: