#202 BString error

open
nobody
None
5
2010-02-04
2010-02-04
Anonymous
No

I found an easy way to make classBString crash

{
BString t((uchar*)"abc",4);
BString t1(t);

t1.erase();
t.erase();
}

if we change BString to String, it will be ok.
But we know that id3lib use BString as Bin Raw Data container
so it's a problem

I had workaround with the template class

void dami::BString::_Split()
{
if (_Ptr != 0 && _Refcnt(_Ptr) != 0 && _Refcnt(_Ptr) != _FROZEN)
{
_E *_Temp = _Ptr;
_Tidy(true);
//assign(_Temp); it will call strlen,but BString can't count by strlen!!
assign(_Temp, _Len);
}
}

Discussion