re PR fortran/14129 ([g77] gcc/f/lex.c buffer size limitation.)

PR fortran/14129
	* lex.c (ffelex_cfelex_): Avoid calling xrealloc on a local stack
	allocated array.

From-SVN: r77849
This commit is contained in:
Roger Sayle 2004-02-15 14:27:14 +00:00 committed by Roger Sayle
parent af1967542f
commit fb264fec48
2 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2004-02-15 Roger Sayle <roger@eyesopen.com>
PR fortran/14129
* lex.c (ffelex_cfelex_): Avoid calling xrealloc on a local stack
allocated array.
2004-02-03 Kazu Hirata <kazu@cs.umass.edu>
* com.c (ffecom_member_phase2_): Use gen_rtx_MEM instead of

View File

@ -694,7 +694,13 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c)
register unsigned bytes_used = (p - q);
buffer_length *= 2;
q = xrealloc (q, buffer_length);
if (q == &buff[0])
{
q = xmalloc (buffer_length);
memcpy (q, buff, bytes_used);
}
else
q = xrealloc (q, buffer_length);
p = &q[bytes_used];
r = &q[buffer_length];
}
@ -754,7 +760,13 @@ ffelex_cfelex_ (ffelexToken *xtoken, FILE *finput, int c)
register unsigned bytes_used = (p - q);
buffer_length = bytes_used * 2;
q = xrealloc (q, buffer_length);
if (q == &buff[0])
{
q = xmalloc (buffer_length);
memcpy (q, buff, bytes_used);
}
else
q = xrealloc (q, buffer_length);
p = &q[bytes_used];
r = &q[buffer_length];
}