This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix fault in assembler when passed a bogus input file.
- From: Nick Clifton <nickc at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 5 Dec 2016 17:37:35 -0000
- Subject: [binutils-gdb] Fix fault in assembler when passed a bogus input file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f49547a604b4dd2c75e3636d4a422d52edc4fa6c
commit f49547a604b4dd2c75e3636d4a422d52edc4fa6c
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Dec 5 17:36:45 2016 +0000
Fix fault in assembler when passed a bogus input file.
PR gas/20902
* read.c (next_char_of_string): Do end advance past the end of the
buffer.
Diff:
---
gas/ChangeLog | 4 ++++
gas/read.c | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a5622c7..7a15455 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,9 @@
2016-12-05 Nick Clifton <nickc@redhat.com>
+ PR gas/20902
+ * read.c (next_char_of_string): Do end advance past the end of the
+ buffer.
+
PR gas/20904
* as.h (SKIP_ALL_WHITESPACE): New macro.
* expr.c (operand): Use it.
diff --git a/gas/read.c b/gas/read.c
index 2f756db..0cc0d20 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5533,6 +5533,12 @@ next_char_of_string (void)
c = *input_line_pointer++ & CHAR_MASK;
switch (c)
{
+ case 0:
+ /* PR 20902: Do not advance past the end of the buffer. */
+ -- input_line_pointer;
+ c = NOT_A_CHAR;
+ break;
+
case '\"':
c = NOT_A_CHAR;
break;
@@ -5629,6 +5635,12 @@ next_char_of_string (void)
bump_line_counters ();
break;
+ case 0:
+ /* Do not advance past the end of the buffer. */
+ -- input_line_pointer;
+ c = NOT_A_CHAR;
+ break;
+
default:
#ifdef ONLY_STANDARD_ESCAPES