incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject RE: [PATCH] RE: [jira] Created: (STDCXX-427) SIGSEGV in istringstream::str()
Date Fri, 25 May 2007 06:31:36 GMT
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com] 
> Sent: Friday, May 25, 2007 4:17 AM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: [PATCH] RE: [jira] Created: (STDCXX-427) SIGSEGV 
> in istringstream::str()
> 
> Farid Zaripov wrote:
> >> -----Original Message-----
> >> From: Martin Sebor (JIRA) [mailto:jira@apache.org]
> >> Sent: Thursday, May 24, 2007 1:14 AM
> >> To: stdcxx-dev@incubator.apache.org
> >> Subject: [jira] Created: (STDCXX-427) SIGSEGV in 
> istringstream::str()
> >>
> >   The bug also reproduced on MSVC. The proposed patch below:
> 
> Thanks for looking into it!
> 
> I'm not sure your proposed patch is correct or necessary 
> (although I'm not saying the original code is correct either).
> In fact, I'm not sure the other overload of str(), i.e., the 
> one that sets the string buffer, is correct either and I 
> suspect that might be the root of the problem.
> The function should assert(this->_C_is_valid()) as a postcondition
> (and the overload below should do the same as a precondition) to 
> verify that the buffer is in a stable and consistent state.
> Let's see if the assertion passes first before considering 
> this patch further.

  The basic_stringbuf<>::str (const char_type *, _RWSTD_SIZE_T)
have the assertions at begin and at end (sstream.cc line 72 and 167),
and
both assertions passes.

  The bug is in that len calculated as highmark - pbase(), but pbase()
== 0
when buffer opened only in input mode. The begin of the buffer is always
this->_C_buffer with any openmode. So len = highmark - _C_buffer is
correct, I think.

Farid.

Mime
View raw message