This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/25421] New: catching exception from codecvt_byname() segfaults
- From: "debian-gcc at lists dot debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Dec 2005 21:45:21 -0000
- Subject: [Bug libstdc++/25421] New: catching exception from codecvt_byname() segfaults
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
[forwarded from http://bugs.debian.org/343108]
4.0 branch 20051204, 4.1 20051124
The following code segfaults. Looks like a double delete,
_S_destroy_c_locale() being called twice: first in the regular path of
codecvt.h:codecvt_byname ctor, then a second time when ~codecvt() is
automatically called to clean up the inherited class.
#include <iostream>
#include <stdexcept>
typedef std::codecvt_byname<wchar_t, char, mbstate_t> cvt_byname_t;
int main()
{
cvt_byname_t *cvt;
char name[] = "invalid-loc";
try {
cvt = new cvt_byname_t(name);
} catch (const std::runtime_error& re) {
std::cerr << "successfully catched misnamed locale" << std::endl;
}
}
--
Summary: catching exception from codecvt_byname() segfaults
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25421