summaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-04-12 21:50:09 +0930
committerAlan Modra <amodra@gmail.com>2022-04-13 10:07:21 +0930
commit10c0005660cda5ff317da5834e919ce99e517c0e (patch)
tree60b76922629a62879b083581afbfaa6c561f10b6 /ld/ldlang.c
parent1b35e577c30060df004135d58704afc4e9f93e3a (diff)
downloadbinutils-gdb-10c0005660cda5ff317da5834e919ce99e517c0e.tar.gz
ubsan: member access within null pointer of union
Add some nonsense to cover "undefined behaviour". * ldlang.c (section_for_dot): Avoid UB.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 1c8d229326c..f10557af842 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6726,7 +6726,7 @@ section_for_dot (void)
if (stmt->header.type == lang_output_section_statement_enum)
break;
- os = &stmt->output_section_statement;
+ os = stmt ? &stmt->output_section_statement : NULL;
while (os != NULL
&& !os->after_end
&& (os->bfd_section == NULL