]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix: Null pointer dereference in ldlex.l
authorNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 16:52:39 +0000 (17:52 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 9 Oct 2023 16:52:39 +0000 (17:52 +0100)
  PR 30951
  * ldlex.l (yy_input): Check for YY_CURRENT_BUFFER being NULL.

ld/ChangeLog
ld/ldlex.l

index 8423dd4ac295b3ffea0e8b6769362761bee83b3a..05b88ee0b942b2d7a300fbf6c9c28ab898d21696 100644 (file)
@@ -1,5 +1,8 @@
 2023-10-09  Nick Clifton  <nickc@redhat.com>
 
+       PR 30951
+       * ldlex.l (yy_input): Check for YY_CURRENT_BUFFER being NULL.
+
        PR 30954
        * ldlang.c (map_input_to_output_sections): Check that os is non
        NULL before using it.
index 435172c08c30269988d37747625a5fdecc338353..94b2ea70acd7a84e9edd1a51a4012cb2a098eb0f 100644 (file)
@@ -668,7 +668,7 @@ static int
 yy_input (char *buf, int max_size)
 {
   int result = 0;
-  if (YY_CURRENT_BUFFER->yy_input_file)
+  if (YY_CURRENT_BUFFER != NULL && YY_CURRENT_BUFFER->yy_input_file)
     {
       if (yyin)
        {