]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR22201, DW_AT_name with out of bounds reference
authorAlan Modra <amodra@gmail.com>
Mon, 25 Sep 2017 10:16:34 +0000 (19:46 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 25 Sep 2017 12:31:47 +0000 (22:01 +0930)
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.

bfd/ChangeLog
bfd/dwarf2.c

index adbc014b5c1635be58a4eb102acc40279f51a19b..ee286c46e1c16a6ccdfa9cc0bc1c7cd0e4634000 100644 (file)
@@ -1,3 +1,10 @@
+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
index 8abb3f0b37ac70c02d7f4ac9652b359b483e1346..9ae5fba63790c59f9e2aab5f2313d412822fdde9 100644 (file)
@@ -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: