]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR25827, Null pointer dereferencing in scan_unit_for_symbols
authorAlan Modra <amodra@gmail.com>
Thu, 16 Apr 2020 08:19:38 +0000 (17:49 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 16 Apr 2020 08:25:04 +0000 (17:55 +0930)
PR 25827
* dwarf2.c (scan_unit_for_symbols): Wrap overlong lines.  Don't
strdup(0).

bfd/ChangeLog
bfd/dwarf2.c

index 2cf36f4c3e0a669e4fbf9112bf74c89f9146f7ec..bb6b9f2261c226d29fbbecb8894114243765e013 100644 (file)
@@ -1,3 +1,9 @@
+2020-04-16  Alan Modra  <amodra@gmail.com>
+
+       PR 25827
+       * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines.  Don't
+       strdup(0).
+
 2020-04-15  Fangrui Song <maskray@google.com>
 
        PR binutils/24613
index 3ee753d0aa4cda8a0c1d6748c5d4ae298a245bed..48b1bdc914a283c78ed63dac04a0f7b80ab655ff 100644 (file)
@@ -3379,18 +3379,20 @@ scan_unit_for_symbols (struct comp_unit *unit)
                    {
                      struct varinfo * spec_var;
 
-                     spec_var = lookup_var_by_offset (attr.u.val, unit->variable_table);
+                     spec_var = lookup_var_by_offset (attr.u.val,
+                                                      unit->variable_table);
                      if (spec_var == NULL)
                        {       
-                         _bfd_error_handler
-                           (_("DWARF error: could not find variable specification at offset %lx"),
-                            (unsigned long) attr.u.val);
+                         _bfd_error_handler (_("DWARF error: could not find "
+                                               "variable specification "
+                                               "at offset %lx"),
+                                             (unsigned long) attr.u.val);
                          break;
                        }
 
                      if (var->name == NULL)
                        var->name = spec_var->name;
-                     if (var->file == NULL)
+                     if (var->file == NULL && spec_var->file != NULL)
                        var->file = strdup (spec_var->file);
                      if (var->line == 0)
                        var->line = spec_var->line;