make check fails at test-demangle line 791 as: ./test-demangle < ../../../libiberty/testsuite/demangle-expected FAIL at line 791, style gnu: in: __cl__C11VHDLLibraryGt4PixX3Z11VHDLLibraryZ14VHDLLibraryRepZt4List1Z10VHDLEntity@ out: exp: VHDLLibrary::operator()(PixX<VHDLLibrary, VHDLLibraryRep, List<VHDLEntity> >) const ./test-demangle: 649 tests, 1 failures Release: gcc-3.3 Environment: HP-B2600 Workstation HPUX11.00 (hppa2.0w-hp-hpux11.00) How-To-Repeat: build gcc-3.3 and run make check
Fix: This test (line791) contains 80 chars, overruns the buffer in test-demangle.c diff -u2 /home/tenma/gcc-3.3/libiberty/testsuite/test-demangle.c.\~1\~ /home/tenma/gcc-3.3/libiberty/testsuite/test-demangle.c --- /home/tenma/gcc-3.3/libiberty/testsuite/test-demangle.c.~1~ Thu Sep 12 04:58:02 2002 +++ /home/tenma/gcc-3.3/libiberty/testsuite/test-demangle.c Fri May 16 12:37:29 2003 @@ -38,5 +38,5 @@ /* Safely read a single line of arbitrary length from standard input. */ -#define LINELEN 80 +#define LINELEN 160 static void
This should go into 3.3.1, it is an easy patch.
Cannot confirm but It is an obvious error. Still on mainline (20030523).
Zack, I couldn't find where this file came from exactly, but you checked it in. I think the one-line patch here is safe. Can you take care of this PR? Thanks W.
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?
*** Bug 8346 has been marked as a duplicate of this bug. ***
Subject: Re: [Bug other/10810] gcc-3.3 fails make check: buffer overrun in tes I'm at the summit for the next two days, then leave for Europe Monday evening. Could someone else try the suggested fix? > > 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. >
Subject: Re: [Bug other/10810] gcc-3.3 fails make check: buffer overrun in tes > 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) This works. Tested on hppa2.0-hp-hpux11.11 and hppa64-hp-hpux11.11. Dave
See: <http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00443.html>.