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

Bug#409494: Segmentation fault in iconv_open/iconv_close for some encodings in some sequence



Package: libc6
Version: 2.3.2.ds1-22

iconv_open and iconv_close for some encodings in some sequence causes
Segmentation fault. I`m stable reproduce segmentation fault only with
static linking. Without static linking reproduce error more difficult.
Here is a transcript:

$ cat bug1.cpp
#include <iostream>
#include <iconv.h>

int main( int argc, char* const argv[] )
{
    iconv_t cd;

    cd = iconv_open( "CP1251" ,"UTF-8" );
    iconv_close( cd );

    cd = iconv_open( "IBM866" ,"UTF-8" );
    iconv_close( cd );

    cd = iconv_open( "KOI8-R" ,"UTF-8" );
    iconv_close( cd );

    cd = iconv_open( "ISO_8859-5" ,"UTF-8" );
    iconv_close( cd );

    cd = iconv_open( "CP1251" ,"UTF-8" );
    std::cerr << "UTF-8 -> CP1251 iconv_open() done.\n";

    iconv_close( cd ); // Segmentation fault
    std::cerr << "UTF-8 -> CP1251 iconv_close() done.\n";
}

$ g++ -O0 -Wall -c bug1.cpp
$ libtool --mode=link g++ -o bug1 -all-static bug1.o

$ ./bug1 
UTF-8 -> CP1251 iconv_open() done.
Segmentation fault

I am using:

$ g++ --version
g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)

$ libtool --version
$ ltmain.sh (GNU libtool) 1.5.6 (1.1220.2.95 2004/04/11 05:50:42) Debian: 224 $

$ ls -l /lib/libc.so.6
lrwxrwxrwx  1 root root 13 2005-09-01 00:50 /lib/libc.so.6 -> libc-2.3.2.so

$ dpkg -s libc6 | grep ^Version
Version: 2.3.2.ds1-22

$ dpkg -s libc6-dev | grep ^Version
Version: 2.3.2.ds1-22

Debian GNU/Linux 3.1r1 (Sarge)
kernel 2.6.8-2-k7 and 2.6.18 (on another PC)

--
Dmitry Telegin



Reply to: