This is the mail archive of the libstdc++-prs@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: libstdc++/3: Segmentation Faults in substr() and string()


The following reply was made to PR libstdc++/3; it has been noted by GNATS.

From: Benjamin Kosnik <bkoz@cygnus.com>
To: bmosher@csc.com
Cc: libstdc++-gnats@sourceware.cygnus.com,
        GNATS Management <gnats-admin@sourceware.cygnus.com>,
        nobody@sourceware.cygnus.com, libstdc++-prs@sourceware.cygnus.com
Subject: Re: libstdc++/3: Segmentation Faults in substr() and string()
Date: Wed, 25 Aug 1999 12:59:55 -0700 (PDT)

 Bob. 
 
 This database is for the libstdc++-v3 project, not the libstdc++-v2 that
 comes with gcc-2.8.1.
 
 I'd test this for you with v-3, but cannot as your examples are not
 self-contained. I need something I can just compile and debug, not bits of
 your code with dangling class defintions and method calls--
 
 > 
 >   Source code snippet:
 >   ulong
 >   rta:: ParseConnectionNumber(string current_line )
 >   {
 >     string s = current_line;
 >     unsigned long connection_number = 0;
 > 
 >     string cnumber = s.substr(21);  // segfault here
 >   
 >     return connection_number;
 >   }
 > 
 
 what I'd need, is a minimal example that reproduces this. I cannot compile
 this as I don't know the defs for the class rta, or how this method is
 called. Kay?
 
 
 >   If I comment out the offending line in Example One, Example Two appears
 >   in a different code module.  The while() loop correctly processes 
 >   eleven lines of text before segfaulting on the twelfth, which is a 
 >   blank line. Of the eleven lines correctly processed, two were blank.
 >   You'll note the error messages are nearly identical.
 > 
 >   Source code snippet:
 >   Parse44():
 >     int i = 24;
 >     while(!found)
 >       {
 >         fin.getline( buffer, LINELENGTH, '\n' );
 >         cout << "Parse44() buffer[" << i << "] = " << buffer << endl;
 >         str = string(buffer);   // segfault here
 >         cout << "Parse44() str        = " << str << endl;
 >       }
 > 
 
 Again, I need more info.
 
 
 That being said, I can say that making the string class more robust was
 one of the goals of v-3, and what is currently shipping actually passes
 commercial validation suites for chapter 21.
 
 -benjamin
 

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