This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ String Bug



While tracing down an error in the Gtk-- source (a C++ widget library), I
discovered that a certain call resulted in a segfault under the condition
of passing a NULL pointer to it.  I traced it back to the string header
files.  Any passing of a (char*)0 to a function which takes type string
resulted on a seg fault on my out of the box Redhat 5.1 system using
egcs.   

The full trace of the crash leads to the file /usr/include/g++/std/bastring.h
somewhere arround...

  basic_string& assign (const charT* s)
    { return assign (s, traits::length (s)); }

Example:

  #include <string>

  int foo(const string &bar)
    { return 1;
    }

  main()
    {foo((char*)NULL);
    }

To whom should this bug or patches to fix this bug be submitted?  I
am not on this list so be sure to CC me a copy of your reply.

Thank you for your time.

 --Karl




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]