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:
parent
2e84f897e5
commit
b52696f9e5
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2019-11-21 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* ldlang.h (LANG_FOR_EACH_INPUT_STATEMENT): Check for an empty
|
||||
file chain before examining the first input statement.
|
||||
|
||||
2019-11-21 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR 46
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue