From eeeca2197ea8e2953bff22f2bfe2e328d9d16dc2 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 5 Oct 2013 04:31:57 -0400 Subject: [PATCH] Revert "Harden agains network packet overruns" This reverts commit 6c1ea557b5d8093ed26f962178d51c683983d568. --- indra/llmessage/lldatapacker.h | 14 +++----------- indra/llmessage/llmessagetemplate.h | 15 --------------- indra/llmessage/lltemplatemessagereader.cpp | 16 ++++------------ 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index 459d66e17..2b6e57484 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -201,17 +201,9 @@ inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const ch { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { - // Handle invalid packets by throwing an exception and a graceful continue - // 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; - // 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() ); - - // + 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; + return FALSE; } return TRUE; diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 84637885c..a91a8f775 100644 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -364,22 +364,7 @@ public: { if (mHandlerFunc) { - - // Handle invalid packets by throwing an exception and a graceful continue - - // mHandlerFunc(msgsystem, mUserData); - - try - { mHandlerFunc(msgsystem, mUserData); - } - catch( std::string &why ) - { - llwarns << why << llendl; - } - - // - return TRUE; } return FALSE; diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 2710d989e..bfce2ea29 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -511,29 +511,21 @@ BOOL LLTemplateMessageReader::decodeTemplate( void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ) { - // Handle invalid packets by throwing an exception and a graceful continue - // we've run off the end of the packet! - std::stringstream strm; -// llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName - strm << "Ran off end of packet " << mCurrentRMessageTemplate->mName + llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName // << " with id " << mCurrentRecvPacketID << " from " << host << " trying to read " << wanted << " bytes at position " << where << " going past packet end at " << mReceiveSize -// << llendl; - << std::endl; + << llendl; if(gMessageSystem->mVerboseLog) { -// llinfos << "MSG: -> " << host << "\tREAD PAST END:\t" - strm << "MSG: -> " << host << "\tREAD PAST END:\t" + llinfos << "MSG: -> " << host << "\tREAD PAST END:\t" // << mCurrentRecvPacketID << " " -// << getMessageName() << llendl; - << getMessageName() << std::endl; + << getMessageName() << llendl; } gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET); - throw std::string( strm.str() ); } static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages");