From: Nick Clifton Date: Mon, 9 Oct 2023 16:52:39 +0000 (+0100) Subject: Fix: Null pointer dereference in ldlex.l X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1b334e27f8410c7fbe3417023258eb9e03ec9592;p=binutils-gdb.git Fix: Null pointer dereference in ldlex.l PR 30951 * ldlex.l (yy_input): Check for YY_CURRENT_BUFFER being NULL. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 8423dd4ac29..05b88ee0b94 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,8 @@ 2023-10-09 Nick Clifton + 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. diff --git a/ld/ldlex.l b/ld/ldlex.l index 435172c08c3..94b2ea70acd 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -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) {