* PATCH: Allow UNGETC to work with an empty buffer
@ 2007-07-20 9:12 Nick Clifton
0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2007-07-20 9:12 UTC (permalink / raw)
To: binutils
Hi Guys,
I am checking in the patch below to fix a bug discovered by the
current mainline gcc sources. I was running a bootstrap build when
it failed because it had worked out that one of the calls to the
UNGETC macro in do_scrub_chars() would push a character into an
empty buffer. It was a very neat bit of analysis of a corner
condition that had obviously been there for a long time.
Cheers
Nick
gas/ChangeLog
2007-07-20 Nick Clifton <nickc@redhat.com>
* app.c (do_scrub_chars): Provide a one character buffer to hold a
pushed back newline at the end of an unterminated quoted string.
Index: gas/app.c
===================================================================
RCS file: /cvs/src/src/gas/app.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 app.c
*** gas/app.c 3 Jul 2007 11:01:02 -0000 1.43
--- gas/app.c 20 Jul 2007 08:03:01 -0000
*************** do_scrub_chars (int (*get) (char *, int)
*** 558,565 ****
--- 558,571 ----
ch = GET ();
if (ch == EOF)
{
+ /* This buffer is here specifically so
+ that the UNGET below will work. */
+ static char one_char_buf[1];
+
as_warn (_("end of file in string; '%c' inserted"), quotechar);
state = old_state;
+ from = fromend = one_char_buf + 1;
+ fromlen = 1;
UNGET ('\n');
PUT (quotechar);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-20 8:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-20 9:12 PATCH: Allow UNGETC to work with an empty buffer Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).