From 10c0005660cda5ff317da5834e919ce99e517c0e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 12 Apr 2022 21:50:09 +0930 Subject: [PATCH] ubsan: member access within null pointer of union Add some nonsense to cover "undefined behaviour". * ldlang.c (section_for_dot): Avoid UB. --- ld/ldlang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.30.2