This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/5259: Assigning a null char * to a std::string causes seg fault
- From: Michael Henderson <mdhender at tin dot dcs dot eis dot lmco dot com>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Wed, 02 Jan 2002 15:31:31 -0500 (EST)
- Subject: libstdc++/5259: Assigning a null char * to a std::string causes seg fault
>Number: 5259
>Category: libstdc++
>Synopsis: Assigning a null char * to a std::string causes seg fault
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jan 02 12:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Michael Henderson
>Release: 3.0.3
>Organization:
Lockheed Martin
>Environment:
System: SunOS tin 5.6 Generic_105181-23 sun4u sparc SUNW,Ultra-4
Architecture: sun4
host: sparc-sun-solaris2.6
build: sparc-sun-solaris2.6
target: sparc-sun-solaris2.6
configured with: /ftp/lmphr/local/src/gnu/gcc/gcc-3.0.3/configure -prefix=/ftp/lmpbn/local -enable-languages=c++ -enable-shared
>Description:
Compile program, run as ./nullstr to fail, ./nullstr to pass
#include <string>
int
main(int argc, char*argv[])
{
char *pStr = argc > 1 ? argv[0] : (char*)0;
std::string str = pStr;
return 0;
}
>How-To-Repeat:
>Fix:
std::string str = pStr ? pStr : "";
>Release-Note:
>Audit-Trail:
>Unformatted: