Revert "Harden agains network packet overruns"

This reverts commit 6c1ea557b5.
This commit is contained in:
Inusaito Sayori
2013-10-05 04:31:57 -04:00
parent 16a8b92d84
commit eeeca2197e
3 changed files with 7 additions and 38 deletions

View File

@@ -201,17 +201,9 @@ inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const ch
{ {
if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size)
{ {
// <FS:ND> Handle invalid packets by throwing an exception and a graceful continue llwarns << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << llendl;
// llwarns << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << llendl; llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl;
// llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl; return FALSE;
// return FALSE;
std::stringstream strm;
strm << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << std::endl;
strm << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << std::endl;
throw std::string( strm.str() );
// </FS:ND>
} }
return TRUE; return TRUE;

View File

@@ -364,22 +364,7 @@ public:
{ {
if (mHandlerFunc) if (mHandlerFunc)
{ {
// <FS:ND> Handle invalid packets by throwing an exception and a graceful continue
// mHandlerFunc(msgsystem, mUserData);
try
{
mHandlerFunc(msgsystem, mUserData); mHandlerFunc(msgsystem, mUserData);
}
catch( std::string &why )
{
llwarns << why << llendl;
}
// </FS:ND>
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@@ -511,29 +511,21 @@ BOOL LLTemplateMessageReader::decodeTemplate(
void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ) void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted )
{ {
// <FS:ND> Handle invalid packets by throwing an exception and a graceful continue
// we've run off the end of the packet! // we've run off the end of the packet!
std::stringstream strm; llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName
// llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName
strm << "Ran off end of packet " << mCurrentRMessageTemplate->mName
// << " with id " << mCurrentRecvPacketID // << " with id " << mCurrentRecvPacketID
<< " from " << host << " from " << host
<< " trying to read " << wanted << " trying to read " << wanted
<< " bytes at position " << where << " bytes at position " << where
<< " going past packet end at " << mReceiveSize << " going past packet end at " << mReceiveSize
// << llendl; << llendl;
<< std::endl;
if(gMessageSystem->mVerboseLog) if(gMessageSystem->mVerboseLog)
{ {
// llinfos << "MSG: -> " << host << "\tREAD PAST END:\t" llinfos << "MSG: -> " << host << "\tREAD PAST END:\t"
strm << "MSG: -> " << host << "\tREAD PAST END:\t"
// << mCurrentRecvPacketID << " " // << mCurrentRecvPacketID << " "
// << getMessageName() << llendl; << getMessageName() << llendl;
<< getMessageName() << std::endl;
} }
gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET); gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET);
throw std::string( strm.str() );
} }
static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages"); static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");