This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/9590: ifstream (inherited?) destructor overwrites memory causing segfault
- From: k dot schaefer at icarnegie dot com
- To: gcc-gnats at gcc dot gnu dot org
- Cc: d dot siegel at icarnegie dot com
- Date: 5 Feb 2003 21:50:46 -0000
- Subject: libstdc++/9590: ifstream (inherited?) destructor overwrites memory causing segfault
- Reply-to: k dot schaefer at icarnegie dot com
>Number: 9590
>Category: libstdc++
>Synopsis: ifstream (inherited?) destructor overwrites memory causing segfault
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 05 21:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: k.schaefer@icarnegie.com
>Release: unknown-1.0
>Organization:
>Environment:
Windows 2000 SP3 with Cygwin 1.3.19-1, running g++ (G++) 3.2 20020927 (prerelease)
>Description:
In the following example, uncommenting the char array illustrates that something in the destruction of the ifstream object overwrites memory. Leaving it commented causes a segmenation fault. The char array in the example code is the minimum buffer that will allow the program to execute without faulting.
//--- begin code
#include <fstream>
using namespace std;
//takes one param - a filename
int main(int argc, char *argv[]) {
//when uncommented allows program not to segfault.
//char a[17];
ifstream infile(argv[1]);
infile.close();
return 0;
}
// -- end code
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: