--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: Segmentation fault in iconv_open/iconv_close for some encodings in some sequence
- From: Dmitry-T <dmitry-t@yandex.ru>
- Date: Sat, 3 Feb 2007 20:02:15 +0400
- Message-id: <20070203200215.38b31a47.dmitry-t@yandex.ru>
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
--- End Message ---
--- Begin Message ---
- To: Dmitry-T <dmitry-t@yandex.ru>, 409494-done@bugs.debian.org
- Subject: Re: Segmentation fault in iconv_open/iconv_close for some encodings in some sequence
- From: Aurelien Jarno <aurelien@aurel32.net>
- Date: Fri, 20 Apr 2007 19:24:08 +0200
- Message-id: <20070420172405.GA1349@i386.aurel32.net>
- In-reply-to: <20070203200215.38b31a47.dmitry-t@yandex.ru>
- References: <20070203200215.38b31a47.dmitry-t@yandex.ru>
Version: 2.5-1
On Sat, Feb 03, 2007 at 08:02:15PM +0400, Dmitry-T wrote:
> 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)
>
This bug is not present anymore in glibc 2.5-1, closing the bug.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
--- End Message ---