c-lex.c (yylex): Fix boundary conditions in character literal and string literal loops.

1998-07-27  Dave Brolley  <brolley@cygnus.com>
	* c-lex.c (yylex): Fix boundary conditions in character literal and
	string literal loops.

From-SVN: r21412
This commit is contained in:
Dave Brolley 1998-07-27 12:37:16 +00:00 committed by Dave Brolley
parent 84530511d2
commit ea6c114284
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
1998-07-27 Dave Brolley <brolley@cygnus.com>
* c-lex.c (yylex): Fix boundary conditions in character literal and
string literal loops.
1998-07-24 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (lookup_name_real): OK, do return the from_obj value

View File

@ -4132,7 +4132,7 @@ real_yylex ()
int char_len = -1;
for (i = 0; i < longest_char; ++i)
{
if (p + i == token_buffer + maxtoken)
if (p + i >= token_buffer + maxtoken)
p = extend_token_buffer (p);
p[i] = c;
@ -4169,7 +4169,7 @@ real_yylex ()
unsigned bytemask = (1 << width) - 1;
int byte;
if (p + WCHAR_BYTES >= token_buffer + maxtoken)
if (p + WCHAR_BYTES > token_buffer + maxtoken)
p = extend_token_buffer (p);
for (byte = 0; byte < WCHAR_BYTES; ++byte)
@ -4188,7 +4188,7 @@ real_yylex ()
}
else
{
if (p == token_buffer + maxtoken)
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p++ = c;
}
@ -4205,14 +4205,14 @@ real_yylex ()
or with a wide zero. */
if (wide_flag)
{
if (p + WCHAR_BYTES >= token_buffer + maxtoken)
if (p + WCHAR_BYTES > token_buffer + maxtoken)
p = extend_token_buffer (p);
bzero (p, WCHAR_BYTES);
p += WCHAR_BYTES;
}
else
{
if (p == token_buffer + maxtoken)
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p++ = 0;
}