aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-03-07 12:20:00 +1030
committerAlan Modra <amodra@gmail.com>2017-03-07 12:33:28 +1030
commitd933941d6c5ce5b2dcaaa869919b6f3de06b725d (patch)
treef3d3e6736ee92271352158262f235f0d1ef26a93 /ld/ldlang.c
parentb1b07054c08eea65ba8d1a9f771796d686f337e5 (diff)
downloadgdb-d933941d6c5ce5b2dcaaa869919b6f3de06b725d.zip
gdb-d933941d6c5ce5b2dcaaa869919b6f3de06b725d.tar.gz
gdb-d933941d6c5ce5b2dcaaa869919b6f3de06b725d.tar.bz2
Fix ld uninitialized read of script ASSERT data structure
lang_assignment_statement serves both assignments and asserts. * ldlang.c (open_input_bfds): Check that lang_assignment_statement is not an assert before referencing defsym.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1396c5b..ff6ef39 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3374,7 +3374,8 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
#endif
break;
case lang_assignment_statement_enum:
- if (s->assignment_statement.exp->assign.defsym)
+ if (s->assignment_statement.exp->type.node_class != etree_assert
+ && s->assignment_statement.exp->assign.defsym)
/* This is from a --defsym on the command line. */
exp_fold_tree_no_dot (s->assignment_statement.exp);
break;