Fix: A potential null_pointer_deference bug
authorNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 16:13:25 +0000 (17:13 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 16:13:25 +0000 (17:13 +0100)
  PR 30954
  * ldlang.c (map_input_to_output_sections): Check that os is non NULL before using it.

ld/ChangeLog
ld/ldlang.c

index 021a9f9b6630a52d174a9aebe8a826fdb5b8589d..8423dd4ac295b3ffea0e8b6769362761bee83b3a 100644 (file)
@@ -1,3 +1,9 @@
+2023-10-09  Nick Clifton  <nickc@redhat.com>
+
+       PR 30954
+       * ldlang.c (map_input_to_output_sections): Check that os is non
+       NULL before using it.
+
 2023-10-05  A. Wilcox  <awilfox@adelielinux.org>
 
        PR 30905
index b40b4a5a0ed3da83752de273452fa844bff85912..c20247a27d0d3b109c8197f817df92a695c89caf 100644 (file)
@@ -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);