mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
Fix potentially undefined behaviour in the linker when parsing input statements.
* ldlang.h (LANG_FOR_EACH_INPUT_STATEMENT): Check for an empty file chain before examining the first input statement.
This commit is contained in:
@@ -574,7 +574,7 @@ extern asection *section_for_dot
|
||||
|
||||
#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
|
||||
lang_input_statement_type *statement; \
|
||||
for (statement = &file_chain.head->input_statement; \
|
||||
for (statement = file_chain.head == NULL ? NULL : &file_chain.head->input_statement; \
|
||||
statement != NULL; \
|
||||
statement = statement->next)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user