gas listing bug
Geoff Berry
geoffb@bops.com
Mon Sep 24 15:09:00 GMT 2001
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;
More information about the Binutils
mailing list