[binutils-gdb] gas s_comm_internal uninitialised access
Alan Modra via Binutils-cvs <[email protected]> Sat, 6 Jun 2026 01:38:53 +0000 (GMT)
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a676181f7b8e520c205c10b82d6b24a3a9cf431 commit 8a676181f7b8e520c205c10b82d6b24a3a9cf431 Author: Alan Modra <[email protected]> Date: Sat Jun 6 11:05:45 2026 +0930 gas s_comm_internal uninitialised access After elf_common_parse calls ignore_rest_of_line on some errors, s_comm_internal calls demand_empty_rest_of_line. These functions cannot be both called, as they consume the end_of_stmt char in the input buffer and the second call then consumes the next line of input, which may not even be in the input buffer. * config/obj-elf.c (elf_common_parse): Don't call ignore_rest_of_line here. * read.c (ignore_rest_of_line): Expand comment. Diff: --- gas/config/obj-elf.c | 1 - gas/read.c | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 7b120ff8eeb..09a224147e9 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -275,7 +275,6 @@ elf_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT size) *input_line_pointer = '\0'; as_bad (_("bad .common segment %s"), p); *input_line_pointer = c; - ignore_rest_of_line (); return NULL; } /* ??? Don't ask me why these are always global. */ diff --git a/gas/read.c b/gas/read.c index 7a0c73abc5c..5b6a3c115a0 100644 --- a/gas/read.c +++ b/gas/read.c @@ -4101,8 +4101,10 @@ demand_empty_rest_of_line (void) /* Silently advance to the end of a statement. Use this after already having issued an error about something bad. Like demand_empty_rest_of_line, this function may leave input_line_pointer one after buffer_limit; - Don't call it from within expression parsing code in an attempt to - silence further errors. */ + Don't call it twice, and don't call both ignore_rest_of_line and + demand_empty_rest_of_line as that will consume two lines of input. + This rule leads to: Don't call it from within expression parsing + code in an attempt to silence further errors. */ void ignore_rest_of_line (void)