aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-04-16 17:49:38 +0930
committerAlan Modra <amodra@gmail.com>2020-04-16 17:55:04 +0930
commitaec72fda3b320c36eb99fc1c4cf95b10fc026729 (patch)
tree6dbb3b680cb434ff4ea8d7cc74248bf956f149e2 /bfd
parentc54a9b56696e584c2b8c7146caac337c063f5516 (diff)
downloadgdb-aec72fda3b320c36eb99fc1c4cf95b10fc026729.zip
gdb-aec72fda3b320c36eb99fc1c4cf95b10fc026729.tar.gz
gdb-aec72fda3b320c36eb99fc1c4cf95b10fc026729.tar.bz2
PR25827, Null pointer dereferencing in scan_unit_for_symbols
PR 25827 * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't strdup(0).
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/dwarf2.c12
2 files changed, 13 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2cf36f4..bb6b9f2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 3ee753d..48b1bdc 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -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;