This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
gas listing bug
- To: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Subject: gas listing bug
- From: Geoff Berry <geoffb at bops dot com>
- Date: Mon, 24 Sep 2001 18:09:38 -0400
Hi,
I ran across a bug in listing file generation that was crashing gas. I
tracked the problem down to a file ending with a long line (~100 characters)
and no newline. Here's a patch that fixes the problem:
2001-09-24 Geoff Berry <geoff.berry@bops.com>
* listing.c: Don't write past the end of `line' when EOF is reached.
Index: gas/listing.c
===================================================================
RCS file: /cvs/src/src/gas/listing.c,v
retrieving revision 1.17
diff -u -u -p -r1.17 listing.c
--- listing.c 2001/09/19 05:33:19 1.17
+++ listing.c 2001/09/24 21:56:14
@@ -513,9 +513,12 @@ buffer_line (file, line, size)
if (c == EOF)
{
file->at_end = 1;
- *p++ = '.';
- *p++ = '.';
- *p++ = '.';
+ if (count + 2 < size)
+ {
+ *p++ = '.';
+ *p++ = '.';
+ *p++ = '.';
+ }
}
file->linenum++;
*p++ = 0;