[reSIProcate] String corruption?

Christian_Gavin at logitech.com Christian_Gavin at logitech.com
Tue Jul 12 15:51:20 CDT 2005


In os\data.cxx

const char*
Data::c_str() const
{
   own();

   if (mSize >= mCapacity)      // !ah! we were overwritting the end
   {                            // !ah! when mSize == mCapacity !!
       const_cast<Data*>(this)->resize(mSize+1,true);
   }
   // mostly is zero terminated, but not by DataStream
   mBuf[mSize] = 0;
   return mBuf;
}

Does the comment imply that mSize should never be greater than mCapacity
and if it was it would mean memory corruption? Could that explain the crash
I am experiencing in the delete operator?

Thanks!
CG




More information about the resiprocate-devel mailing list