libstdc++/9590: ifstream (inherited?) destructor overwrites memory causing segfault
k.schaefer@icarnegie.com
k.schaefer@icarnegie.com
Wed Feb 5 21:56:00 GMT 2003
>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:
More information about the Gcc-bugs
mailing list