[Bug libstdc++/21262] New: basic_string out_of_bound in constructor with null char in string

dan at verliba dot cz gcc-bugzilla@gcc.gnu.org
Thu Apr 28 09:11:00 GMT 2005


gcc -v
Reading specs from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.1/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-
slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared -
-enable-threads=posix --disable-checking --enable-long-long --enable-
__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions --enable-
languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-
zlib
Thread model: posix
gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)

source file:

#include <string>
using namespace std;
int main()
{
        string str("abcdef\0hijklmnop",15);
        string str2(str.data(), 10, str.size() - 10);
        return 0;
}

g++ -o test test.cpp

./test

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::basic_string
Aborted (core dumped)

ldd test
        linux-gate.so.1 =>  (0xffffe000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40029000)
        libm.so.6 => /lib/tls/libm.so.6 (0x400fb000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4011e000)
        libc.so.6 ...

rpm -q --whatprovides /usr/lib/libstdc++.so.6
libstdc++6-3.4.1-3mdk

-- 
           Summary: basic_string out_of_bound in constructor with null char
                    in string
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dan at verliba dot cz
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i586-mandrake-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21262



More information about the Gcc-bugs mailing list