[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#343108: libstdc++6-4.0-dev: catching exception from codecvt_byname() segfaults



Package: libstdc++6-4.0-dev
Version: 4.0.2-5
Severity: normal


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;
   }
}
		  



-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages libstdc++6-4.0-dev depends on:
ii  g++-4.0                       4.0.2-5    The GNU C++ compiler
ii  gcc-4.0-base                  4.0.2-5    The GNU Compiler Collection (base 
ii  libc6-dev                     2.3.5-8    GNU C Library: Development Librari
ii  libstdc++6                    4.0.2-5    The GNU Standard C++ Library v3

libstdc++6-4.0-dev recommends no packages.

-- no debconf information



Reply to: