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

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

From-SVN: r21413
This commit is contained in:
Dave Brolley 1998-07-27 12:51:56 +00:00 committed by Dave Brolley
parent ea6c114284
commit 45e0984cdb
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Mon Jul 27 14:22:36 1998 Dave Brolley <brolley@cygnus.com>
* c-lex.c (yylex): Fix boundary conditions in character literal and
string literal loops.
Mon Jul 27 11:43:54 1998 Stan Cox <scox@cygnus.com>
* longlong.h (count_leading_zeros): Sparclite scan instruction was

View File

@ -1994,7 +1994,7 @@ 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;
@ -2031,7 +2031,7 @@ 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)
@ -2050,7 +2050,7 @@ yylex ()
}
else
{
if (p == token_buffer + maxtoken)
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
*p++ = c;
}
@ -2063,14 +2063,14 @@ 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;
}