From ee1cb49e5a9de8049d887abd8c9f2eff1851147e Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 9 Oct 2023 17:13:25 +0100 Subject: [PATCH] Fix: A potential null_pointer_deference bug PR 30954 * ldlang.c (map_input_to_output_sections): Check that os is non NULL before using it. --- ld/ChangeLog | 6 ++++++ ld/ldlang.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ld/ChangeLog b/ld/ChangeLog index 021a9f9b663..8423dd4ac29 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2023-10-09 Nick Clifton + + PR 30954 + * ldlang.c (map_input_to_output_sections): Check that os is non + NULL before using it. + 2023-10-05 A. Wilcox PR 30905 diff --git a/ld/ldlang.c b/ld/ldlang.c index b40b4a5a0ed..c20247a27d0 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4198,6 +4198,9 @@ map_input_to_output_sections os); break; case lang_data_statement_enum: + if (os == NULL) + /* This should never happen. */ + FAIL (); /* Make sure that any sections mentioned in the expression are initialized. */ exp_init_os (s->data_statement.exp); -- 2.39.2