* ubsan: member access within null pointer of union
@ 2022-04-13 5:40 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-04-13 5:40 UTC (permalink / raw)
To: binutils
Add some nonsense to cover "undefined behaviour".
* ldlang.c (section_for_dot): Avoid UB.
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
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-13 5:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 5:40 ubsan: member access within null pointer of union Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).