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.
This commit is contained in:
Nick Clifton 2016-12-05 17:36:45 +00:00
parent 14c1428b29
commit f49547a604
2 changed files with 16 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2016-12-05 Nick Clifton <nickc@redhat.com> 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 PR gas/20904
* as.h (SKIP_ALL_WHITESPACE): New macro. * as.h (SKIP_ALL_WHITESPACE): New macro.
* expr.c (operand): Use it. * expr.c (operand): Use it.

View file

@ -5533,6 +5533,12 @@ next_char_of_string (void)
c = *input_line_pointer++ & CHAR_MASK; c = *input_line_pointer++ & CHAR_MASK;
switch (c) switch (c)
{ {
case 0:
/* PR 20902: Do not advance past the end of the buffer. */
-- input_line_pointer;
c = NOT_A_CHAR;
break;
case '\"': case '\"':
c = NOT_A_CHAR; c = NOT_A_CHAR;
break; break;
@ -5629,6 +5635,12 @@ next_char_of_string (void)
bump_line_counters (); bump_line_counters ();
break; break;
case 0:
/* Do not advance past the end of the buffer. */
-- input_line_pointer;
c = NOT_A_CHAR;
break;
default: default:
#ifdef ONLY_STANDARD_ESCAPES #ifdef ONLY_STANDARD_ESCAPES