diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llsdserialize.cpp | 14 | ||||
-rw-r--r-- | indra/llcommon/llthread.cpp | 7 | ||||
-rw-r--r-- | indra/llcommon/llthread.h | 10 | ||||
-rw-r--r-- | indra/llcommon/llversionserver.h | 2 |
4 files changed, 21 insertions, 12 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 02152cfe79..6f4a49180d 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -227,7 +227,8 @@ F64 ll_ntohd(F64 netdouble) * * @param istr The stream to read from. * @param value [out] The string which was found. - * @param max_bytes The maximum possible length of the string. + * @param max_bytes The maximum possible length of the string. Passing in + * a negative value will skip this check. * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ @@ -251,7 +252,8 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d); * leading the stream. * @param value [out] The string which was found. * @param d The delimiter to use. - * @param max_bytes The maximum possible length of the string. + * @param max_bytes The maximum possible length of the string. Passing in + * a negative value will skip this check. * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ @@ -768,7 +770,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const // We probably have a valid raw binary stream. determine // the size, and read it. S32 len = strtol(buf + 2, NULL, 0); - if(len > mMaxBytesLeft) return false; + if(mCheckLimits && (len > mMaxBytesLeft)) return false; std::vector<U8> value; if(len) { @@ -1043,7 +1045,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const U32 size_nbo = 0; read(istr, (char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/ S32 size = (S32)ntohl(size_nbo); - if(size > mMaxBytesLeft) + if(mCheckLimits && (size > mMaxBytesLeft)) { parse_count = PARSE_FAILURE; } @@ -1179,7 +1181,7 @@ bool LLSDBinaryParser::parseString( U32 value_nbo = 0; read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/ S32 size = (S32)ntohl(value_nbo); - if(size > mMaxBytesLeft) return false; + if(mCheckLimits && (size > mMaxBytesLeft)) return false; std::vector<char> buf; if(size) { @@ -1635,7 +1637,7 @@ int deserialize_string_raw( // the size, and read it. // *FIX: This is memory inefficient. S32 len = strtol(buf + 1, NULL, 0); - if(len > max_bytes) return LLSDParser::PARSE_FAILURE; + if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE; std::vector<char> buf; if(len) { diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index ea877bda84..02ed0dcfc6 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -31,6 +31,8 @@ #include "linden_common.h" #include "llapr.h" +#include "apr-1/apr_portable.h" + #include "llthread.h" #include "lltimer.h" @@ -225,6 +227,11 @@ void LLThread::setQuitting() wake(); } +// static +U32 LLThread::currentID() +{ + return (U32)apr_os_thread_current(); +} // static void LLThread::yield() diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 8106c08835..a07c64b8fc 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -56,14 +56,14 @@ public: virtual ~LLThread(); // Warning! You almost NEVER want to destroy a thread unless it's in the STOPPED state. virtual void shutdown(); // stops the thread - static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure. - - bool isQuitting() const { return (QUITTING == mStatus); } bool isStopped() const { return (STOPPED == mStatus); } - // PAUSE / RESUME functionality. See source code for important usage notes. + static U32 currentID(); // Return ID of current thread + static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure. + public: + // PAUSE / RESUME functionality. See source code for important usage notes. // Called from MAIN THREAD. void pause(); void unpause(); @@ -127,7 +127,7 @@ protected: class LLMutex { public: - LLMutex(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well. + LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex ~LLMutex(); void lock(); // blocks diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index b7c525be98..b9aa71b4dc 100644 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h @@ -35,7 +35,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 19; const S32 LL_VERSION_PATCH = 1; -const S32 LL_VERSION_BUILD = 80264; +const S32 LL_VERSION_BUILD = 80913; const char * const LL_CHANNEL = "Second Life Server"; |