Farid Zaripov wrote:
-----Original Message-----
From: Martin Sebor [mailto:[EMAIL PROTECTED] Sent: Saturday, May 26, 2007 3:05 AM
To: [email protected]
Subject: Re: [PATCH] RE: [jira] Created: (STDCXX-427) SIGSEGV in istringstream::str()

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.
In input mode (only) the function is supposed to return:

     string(eback(), egptr());

In output mode (or input | output) the function must return:

     string(pbase(), high_mark);

So unless I'm missing something the program below should be a valid (albeit incomplete) test case. Let me know what you think.

  Formally the test case is valid, but logically, I think, the buffer
pointers and the buffer
itself should be in consistency, and in this test eback() and pbase()
are changed from
the real begin of the buffer of the std::stringbuf.

I'm not sure I understand. If the test case is valid but doesn't
pass, the implementation doesn't conform. The only way this could
be acceptable is if the requirement in the standard was unclear
or didn't make sense (in which case we'd need to open an issue
against the standard to clarify/correct the requirement). To me
the requirement in the standard is clear and makes sense. Does
it not to you?

Martin

Reply via email to