This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/10810] gcc-3.3 fails make check: buffer overrun in test_demangle.c


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10810


pinskia@physics.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dave.anglin@nrc.ca


------- Additional Comments From zack@gcc.gnu.org  2003-05-24 02:14 -------
No.  The one-line patch is wrong.  Note the comment above the #define that
got changed: "read a single line *of arbitrary length* from standard input."
That LINELEN define is the *initial* buffer size; getline() is supposed to
enlarge its buffer as needed.

It appears that there is a fencepost error, where the buffer will be overflowed
by one character iff the input line is exactly as long as the buffer.  The
correct fix, then, would be this change, somewhat below:

-      if (count >= alloc)
+      if (count + 1 >= alloc)

I do not have time right now to test that, and I don't see the failure anyway;
could one of you try it and check it in if it works?


------- Additional Comments From pinskia@physics.uc.edu  2003-05-24 20:03 -------
*** Bug 8346 has been marked as a duplicate of this bug. ***



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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