aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-12-05 17:36:45 +0000
committerNick Clifton <nickc@redhat.com>2016-12-05 17:36:45 +0000
commitf49547a604b4dd2c75e3636d4a422d52edc4fa6c (patch)
tree6880ec2de16241285915d476ff76eb04f1cd4c2a /gas/read.c
parent14c1428b29fff12d8119ce6f4703be0de08197af (diff)
downloadgdb-f49547a604b4dd2c75e3636d4a422d52edc4fa6c.zip
gdb-f49547a604b4dd2c75e3636d4a422d52edc4fa6c.tar.gz
gdb-f49547a604b4dd2c75e3636d4a422d52edc4fa6c.tar.bz2
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.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c12
1 files changed, 12 insertions, 0 deletions
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