This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gas listing bug


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]