Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-427

SIGSEGV in istringstream::str()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • None
    • 27. Input/Output
    • None
    • gcc-3.3.3 on Linux

    Description

      This only happens on trunk, not with 4.1.3:

      $ rm t.o && cat t.cpp && make t && gdb -q t
      #include <cassert>
      #include <sstream>
      #include <string>

      int main ()
      {
      using namespace std;

      string str ("test");

      istringstream isstr;

      isstr.str (str);

      assert (isstr.str ().length () == str.length ());

      assert (isstr.str () == str);
      }
      gcc -c -I/amd/devco/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -pthread -I/amd/devco/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-3.3.3_43.41-15s/include -I/amd/devco/sebor/stdcxx/examples/include -pedantic -nostdinc++ -g -m32 -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp
      gcc t.o -o t -pthread -m32 -L/build/sebor/stdcxx-gcc-3.3.3_43.41-15s/lib -lstd15s -lsupc++ -lm
      Using host libthread_db library "/lib64/tls/libthread_db.so.1".
      (gdb) r
      Starting program: /build/sebor/stdcxx-gcc-3.3.3_43.41-15s/examples/t
      [Thread debugging using libthread_db enabled]
      [New Thread 1433271616 (LWP 12696)]

      Program received signal SIGSEGV, Segmentation fault.
      [Switching to Thread 1433271616 (LWP 12696)]
      0x0804eb4c in _rw::_rw_memcpy (dst=0x556e1014, src=0x80900a0,
      nbytes=134672708) at /amd/devco/sebor/stdcxx/src/string.cpp:42
      42 *tmp++ = *csrc++;
      (gdb) where
      #0 0x0804eb4c in _rw::_rw_memcpy (dst=0x556e1014, src=0x80900a0,
      nbytes=134672708) at /amd/devco/sebor/stdcxx/src/string.cpp:42
      #1 0x08053781 in std::char_traits<char>::copy (__dst=0x556e1014 "test",
      __src=0x80900a0 "test", __n=134807716) at _traits.h:425
      #2 0x080562ec in basic_string (this=0xffffd0d0, __s=0x80900a0 "test",
      __n=134807716, __alloc=@0xffffcfc0) at string.cc:185
      #3 0x0805dac5 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str (this=0xffffd048) at sstream:130
      #4 0x08049bc9 in std::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::str (this=0xffffd040) at sstream:268
      #5 0x0804994d in main () at t.cpp:15

      Attachments

        Activity

          People

            farid Farid Zaripov
            sebor Martin Sebor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: