Someone else ever submitted bugs in StringBuffer.
However, in the latest release v.0.8.12, I found a bug
in function StringBuffer::prepend():
void StringBuffer::prepend( const char_t* value ){
int_t sl = stringLength(value);
if ( len+sl+1 > bufferLength )
growBuffer ( len+sl+1 );
//move buffer up
// here is the bug in for statement, len+1 is out of
the array
// boundary
//for ( int_t i=len+1;i>=0;i-- )
for ( int_t i=len;i>=0;i-- )
buffer[i+sl] = buffer[i];
len += sl;
for ( int_t i=0;i<sl;i++ )
buffer[i] = value[i];
}
I didn't check the version in cvs, a "bad gateway"
error occurs while browsing cvs tree.
Logged In: YES
user_id=414645
Thank you for the report.
I started to apply that single fix, but in scrutinizing the
StringBuffer code, found a few other bugs in
StringBuffer.cpp, mostly of the same off-by-one nature. I
ended up changing StringBuffer more extensively than I had
expected, fixing several bugs and also improving performance.
I've just checked these changes into CVS, and I'd appreciate
your feedback. In particular, look at util/StringBuffer.h,
util/StringBuffer.cpp, and also
/CLConfig.h:LUCENE_DEFAULT_TOKEN_BUFFER_SIZE (for some
performance notes).
Since I've made several other important changes in CVS since
the most recent packaged release, I suggest you do a CVS
checkout rather than grabbing only these particular files.
Remember that the StringBuffer-related checkins might not
appear in Sourceforge's anonymous CVS for several hours.
Logged In: YES
user_id=414645
I worked over StringBuffer.cpp in late Aug 2004 and removed
all the bugs I encountered. It's my opinion that the bug(s)
reported here are resolved.
Logged In: YES
user_id=763834
resolved, but uses different code