From 9260fbe0bd4db438632e9f174112b4ed853fa2a0 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 21 Jul 2016 15:38:55 -0400 Subject: add location details to apr status logging --- indra/llcommon/llapr.cpp | 25 ++++--------------------- indra/llcommon/llapr.h | 9 ++++----- 2 files changed, 8 insertions(+), 26 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index a548c96002..61929e184b 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -291,35 +291,18 @@ void LLScopedLock::unlock() //--------------------------------------------------------------------- -bool ll_apr_warn_status(apr_status_t status) +bool _ll_apr_warn_status(apr_status_t status, const char* file, int line) { if(APR_SUCCESS == status) return false; char buf[MAX_STRING]; /* Flawfinder: ignore */ apr_strerror(status, buf, sizeof(buf)); - LL_WARNS("APR") << "APR: " << buf << LL_ENDL; + LL_WARNS("APR") << "APR: " << file << ":" << line << " " << buf << LL_ENDL; return true; } -bool ll_apr_warn_status(apr_status_t status, apr_dso_handle_t *handle) +void _ll_apr_assert_status(apr_status_t status, const char* file, int line) { - bool result = ll_apr_warn_status(status); - // Despite observed truncation of actual Mac dylib load errors, increasing - // this buffer to more than MAX_STRING doesn't help: it appears that APR - // stores the output in a fixed 255-character internal buffer. (*sigh*) - char buf[MAX_STRING]; /* Flawfinder: ignore */ - apr_dso_error(handle, buf, sizeof(buf)); - LL_WARNS("APR") << "APR: " << buf << LL_ENDL; - return result; -} - -void ll_apr_assert_status(apr_status_t status) -{ - llassert(! ll_apr_warn_status(status)); -} - -void ll_apr_assert_status(apr_status_t status, apr_dso_handle_t *handle) -{ - llassert(! ll_apr_warn_status(status, handle)); + llassert(! _ll_apr_warn_status(status, file, line)); } //--------------------------------------------------------------------- diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index b1b0fc4718..1ac5c4e9b2 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -52,12 +52,11 @@ struct apr_dso_handle_t; * APR_SUCCESS. * @return Returns true if status is an error condition. */ -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status); -/// There's a whole other APR error-message function if you pass a DSO handle. -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle); +#define ll_apr_warn_status(status) _ll_apr_warn_status(status, __FILE__, __LINE__) +bool LL_COMMON_API _ll_apr_warn_status(apr_status_t status, const char* file, int line); -void LL_COMMON_API ll_apr_assert_status(apr_status_t status); -void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle); +#define ll_apr_assert_status(status) _ll_apr_assert_status(status, __FILE__, __LINE__) +void LL_COMMON_API _ll_apr_assert_status(apr_status_t status, const char* file, int line); extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool -- cgit v1.2.3 From 436119268da41d45f95e3cf3e4a2954f114d6891 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 11 Aug 2016 14:08:49 -0400 Subject: add convenience function ll_stream_notation_sd for compact representation of llsd --- indra/llcommon/llsdutil.cpp | 11 +++++++++++ indra/llcommon/llsdutil.h | 2 ++ 2 files changed, 13 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 6ad4a97149..8ccd915e6d 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -193,6 +193,17 @@ char* ll_pretty_print_sd(const LLSD& sd) return buffer; } +std::string ll_stream_notation_sd(const LLSD& sd) +{ + std::ostringstream stream; + //stream.rdbuf()->pubsetbuf(buffer, bufferSize); + stream << LLSDOStreamer(sd); + stream << std::ends; + + return stream.str(); +} + + //compares the structure of an LLSD to a template LLSD and stores the //"valid" values in a 3rd LLSD. Default values pulled from the template //if the tested LLSD does not contain the key/value pair. diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 99cb79aa54..01ab6bcb8d 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -56,6 +56,8 @@ LL_COMMON_API char* ll_print_sd(const LLSD& sd); LL_COMMON_API char* ll_pretty_print_sd_ptr(const LLSD* sd); LL_COMMON_API char* ll_pretty_print_sd(const LLSD& sd); +LL_COMMON_API std::string ll_stream_notation_sd(const LLSD& sd); + //compares the structure of an LLSD to a template LLSD and stores the //"valid" values in a 3rd LLSD. Default values //are pulled from the template. Extra keys/values in the test -- cgit v1.2.3 From 0a7fd3686a09a53ebe86e1e37b156e2f04f6cb2f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 27 Feb 2017 09:52:50 -0500 Subject: Look for logcontrol-dev.xml in the user settings directory --- indra/llcommon/llerror.cpp | 37 +++++++++++-------------------------- indra/llcommon/llerrorcontrol.h | 7 +------ 2 files changed, 12 insertions(+), 32 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e6407ecf22..2fe9775e10 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -312,7 +312,7 @@ namespace LOG_CLASS(LogControlFile); public: - static LogControlFile& fromDirectory(const std::string& dir); + static LogControlFile& fromDirectory(const std::string& user_dir, const std::string& app_dir); virtual bool loadFile(); @@ -322,13 +322,12 @@ namespace { } }; - LogControlFile& LogControlFile::fromDirectory(const std::string& dir) + LogControlFile& LogControlFile::fromDirectory(const std::string& user_dir, const std::string& app_dir) { - std::string dirBase = dir + "/"; - // NB: We have no abstraction in llcommon for the "proper" - // delimiter but it turns out that "/" works on all three platforms + // NB: We have no abstraction in llcommon for the "proper" + // delimiter but it turns out that "/" works on all three platforms - std::string file = dirBase + "logcontrol-dev.xml"; + std::string file = user_dir + "/logcontrol-dev.xml"; llstat stat_info; if (LLFile::stat(file, &stat_info)) { @@ -336,7 +335,7 @@ namespace // if it doesn't exist. LLFile has no better abstraction for // testing for file existence. - file = dirBase + "logcontrol.xml"; + file = app_dir + "/logcontrol.xml"; } return * new LogControlFile(file); // NB: This instance is never freed @@ -363,7 +362,7 @@ namespace } LLError::configure(configuration); - LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL; + LL_INFOS("LogControlFile") << "logging reconfigured from " << filename() << LL_ENDL; return true; } @@ -615,7 +614,7 @@ namespace } - void commonInit(const std::string& dir, bool log_to_stderr = true) + void commonInit(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true) { LLError::Settings::getInstance()->reset(); @@ -635,7 +634,7 @@ namespace LLError::addRecorder(recordToWinDebug); #endif - LogControlFile& e = LogControlFile::fromDirectory(dir); + LogControlFile& e = LogControlFile::fromDirectory(user_dir, app_dir); // NOTE: We want to explicitly load the file before we add it to the event timer // that checks for changes to the file. Else, we're not actually loading the file yet, @@ -651,23 +650,9 @@ namespace namespace LLError { - void initForServer(const std::string& identity) + void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr) { - std::string dir = "/opt/linden/etc"; - if (LLApp::instance()) - { - dir = LLApp::instance()->getOption("configdir").asString(); - } - commonInit(dir); -#if !LL_WINDOWS - LLError::RecorderPtr recordToSyslog(new RecordToSyslog(identity)); - addRecorder(recordToSyslog); -#endif - } - - void initForApplication(const std::string& dir, bool log_to_stderr) - { - commonInit(dir, log_to_stderr); + commonInit(user_dir, app_dir, log_to_stderr); } void setPrintLocation(bool print) diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 56e84f7172..caf2ba72c2 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -60,12 +60,7 @@ public: namespace LLError { - LL_COMMON_API void initForServer(const std::string& identity); - // resets all logging settings to defaults needed by server processes - // logs to stderr, syslog, and windows debug log - // the identity string is used for in the syslog - - LL_COMMON_API void initForApplication(const std::string& dir, bool log_to_stderr = true); + LL_COMMON_API void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true); // resets all logging settings to defaults needed by applicaitons // logs to stderr and windows debug log // sets up log configuration from the file logcontrol.xml in dir -- cgit v1.2.3 From 8dff769dc9d899d884b926cd552bdff5e132d73b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 9 Mar 2017 11:32:06 -0500 Subject: do not insert a null char into the std::string when serializing llsd notation --- indra/llcommon/llsdutil.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 8ccd915e6d..9d00395c0a 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -196,10 +196,7 @@ char* ll_pretty_print_sd(const LLSD& sd) std::string ll_stream_notation_sd(const LLSD& sd) { std::ostringstream stream; - //stream.rdbuf()->pubsetbuf(buffer, bufferSize); stream << LLSDOStreamer(sd); - stream << std::ends; - return stream.str(); } -- cgit v1.2.3 From e479d51068e1b9d8c840b263f41d6fe79aee717c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 9 Mar 2017 14:16:33 -0500 Subject: experiment reformatting of tags in log lines --- indra/llcommon/llerror.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 2fe9775e10..02d920b581 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -571,8 +571,9 @@ namespace LLError mFunctionString += std::string(mFunction) + ":"; for (size_t i = 0; i < mTagCount; i++) { - mTagString += std::string("#") + mTags[i] + ((i == mTagCount - 1) ? "" : ","); + mTagString += mTags[i] + ((i == mTagCount - 1) ? "" : ","); } + mTagString += std::string("#"); } CallSite::~CallSite() -- cgit v1.2.3 From dd63291355a09411a2242d7ef84d49eece8cb6e1 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 9 Mar 2017 17:56:30 -0500 Subject: construct tag string without using += --- indra/llcommon/llerror.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 02d920b581..b66c3c3c20 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -571,9 +571,10 @@ namespace LLError mFunctionString += std::string(mFunction) + ":"; for (size_t i = 0; i < mTagCount; i++) { - mTagString += mTags[i] + ((i == mTagCount - 1) ? "" : ","); + mTagString.append(mTags[i]); + mTagString.append((i == mTagCount - 1) ? "" : ","); } - mTagString += std::string("#"); + mTagString.append("#"); } CallSite::~CallSite() -- cgit v1.2.3 From fd3628ef45a8160f2434e0d8b747d31d65685340 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Apr 2017 16:05:59 -0400 Subject: Change certificate store infrastructure to key off of the Subject Key Id rather than sha1 hash, since that is rarely used in modern certs. The previous form was storing trusted certs using an empty sha1 hash value as the key, which meant most certificates matched... not good. Modify the LLCertException to pass certificate information back as LLSD rather than an LLPointer, because when the exception is being thown from the certificate constructor that results in one of a couple of other exceptions (even refcounting won't save you when the problem is that the thing you're pointing to never finished coming into being properly). Update the certificates in the llsechandler_basic_test to modern conventions, and extend the classes to allow for an optional validation date so that the test can use a fixed date. Also make all the certificates include the plain text form for ease of reference. --- indra/llcommon/llthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index c3f235c6ee..c92e284955 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -408,7 +408,7 @@ LLThreadSafeRefCount::~LLThreadSafeRefCount() { if (mRef != 0) { - LL_ERRS() << "deleting non-zero reference" << LL_ENDL; + LL_ERRS() << "deleting referenced object mRef = " << mRef << LL_ENDL; } } -- cgit v1.2.3 From 347015be33559ca035e1b119d361423b906555db Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 20 Jun 2017 17:03:20 -0400 Subject: fix presentation of log tags for better searchability --- indra/llcommon/llerror.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index b66c3c3c20..a1ad9e84b5 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -569,12 +569,13 @@ namespace LLError } #endif mFunctionString += std::string(mFunction) + ":"; + const std::string tag_hash("#"); for (size_t i = 0; i < mTagCount; i++) { + mTagString.append(tag_hash); mTagString.append(mTags[i]); mTagString.append((i == mTagCount - 1) ? "" : ","); } - mTagString.append("#"); } CallSite::~CallSite() -- cgit v1.2.3 From fa53653e60f5761c157b76423b4449fe38788d8f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 24 Jul 2017 14:49:56 -0400 Subject: fix separator between tags and file/function --- indra/llcommon/llerror.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index a1ad9e84b5..e14fd95639 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -574,7 +574,7 @@ namespace LLError { mTagString.append(tag_hash); mTagString.append(mTags[i]); - mTagString.append((i == mTagCount - 1) ? "" : ","); + mTagString.append((i == mTagCount - 1) ? ";" : ","); } } -- cgit v1.2.3 From 6d7c19623d44bbd9dcfcd047e3b3ab2120916481 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 27 Nov 2017 19:04:41 +0200 Subject: MAINT-8022 Crashes in unzip_llsd --- indra/llcommon/llsdserialize.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 3a219eb998..7f286f5e68 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2188,7 +2188,6 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) U8* new_result = (U8*)realloc(result, cur_size + have); if (new_result == NULL) { - LL_WARNS() << "Failed to unzip LLSD block: can't reallocate memory, current size: " << cur_size << " bytes; requested " << cur_size + have << " bytes." << LL_ENDL; inflateEnd(&strm); if (result) { -- cgit v1.2.3 From dcfccc6f435610077592bbddcef2468c64f27f2f Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 28 Nov 2017 15:55:40 +0200 Subject: MAINT-8022 Crashes in unzip_llsd #2 --- indra/llcommon/llsdserialize.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 7f286f5e68..ede212181d 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2144,7 +2144,11 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) const U32 CHUNK = 65536; - U8 *in = new U8[size]; + U8 *in = new(std::nothrow) U8[size]; + if (!in) + { + return false; + } is.read((char*) in, size); U8 out[CHUNK]; -- cgit v1.2.3 From a35008993eef5b1fee5695804c83050cf922d146 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 2 Jan 2018 20:31:23 +0200 Subject: MAINT-8022 String crashes in unzip_llsd --- indra/llcommon/llsdserialize.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index ede212181d..71744aef3c 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2217,24 +2217,42 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) //result now points to the decompressed LLSD block { - std::string res_str((char*) result, cur_size); + std::istringstream istr; + // Since we are using this for meshes, data we are dealing with tend to be large. + // So string can potentially fail to allocate, make sure this won't cause problems + try + { + std::string res_str((char*)result, cur_size); + + std::string deprecated_header(""); - std::string deprecated_header(""); + if (res_str.substr(0, deprecated_header.size()) == deprecated_header) + { + res_str = res_str.substr(deprecated_header.size() + 1, cur_size); + } + cur_size = res_str.size(); - if (res_str.substr(0, deprecated_header.size()) == deprecated_header) + istr.str(res_str); + } + catch (std::length_error) { - res_str = res_str.substr(deprecated_header.size()+1, cur_size); + LL_DEBUGS("UNZIP") << "String we are creating is too big" << LL_ENDL; + free(result); + return false; + } + catch (std::bad_alloc) + { + LL_DEBUGS("UNZIP") << "Failed to allocate for string" << LL_ENDL; + free(result); + return false; } - cur_size = res_str.size(); - std::istringstream istr(res_str); - if (!LLSDSerialize::fromBinary(data, istr, cur_size)) { - LL_WARNS() << "Failed to unzip LLSD block" << LL_ENDL; + LL_WARNS("UNZIP") << "Failed to unzip LLSD block" << LL_ENDL; free(result); return false; - } + } } free(result); -- cgit v1.2.3 From c56298d4ba818aaa5b69a8c30e5b577f7e4596eb Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 3 Jan 2018 16:30:57 +0200 Subject: MAINT-8022 Make unzip silent yet include failure reason into output --- indra/llcommon/llsdserialize.cpp | 34 ++++++++++++---------------------- indra/llcommon/llsdserialize.h | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 23 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 71744aef3c..be54ed053b 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2121,22 +2121,13 @@ std::string zip_llsd(LLSD& data) deflateEnd(&strm); free(output); -#if 0 //verify results work with unzip_llsd - std::istringstream test(result); - LLSD test_sd; - if (!unzip_llsd(test_sd, test, result.size())) - { - LL_ERRS() << "Invalid compression result!" << LL_ENDL; - } -#endif - return result; } //decompress a block of LLSD from provided istream // not very efficient -- creats a copy of decompressed LLSD block in memory // and deserializes from that copy using LLSDSerialize -bool unzip_llsd(LLSD& data, std::istream& is, S32 size) +LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size) { U8* result = NULL; U32 cur_size = 0; @@ -2147,7 +2138,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) U8 *in = new(std::nothrow) U8[size]; if (!in) { - return false; + return ZR_MEM_ERROR; } is.read((char*) in, size); @@ -2171,7 +2162,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) inflateEnd(&strm); free(result); delete [] in; - return false; + return ZR_DATA_ERROR; } switch (ret) @@ -2183,7 +2174,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) inflateEnd(&strm); free(result); delete [] in; - return false; + return ZR_MEM_ERROR; break; } @@ -2198,7 +2189,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) free(result); } delete[] in; - return false; + return ZR_MEM_ERROR; } result = new_result; memcpy(result+cur_size, out, have); @@ -2212,7 +2203,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) if (ret != Z_STREAM_END) { free(result); - return false; + return ZR_DATA_ERROR; } //result now points to the decompressed LLSD block @@ -2234,29 +2225,28 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) istr.str(res_str); } +#ifdef LL_WINDOWS catch (std::length_error) { - LL_DEBUGS("UNZIP") << "String we are creating is too big" << LL_ENDL; free(result); - return false; + return ZR_SIZE_ERROR; } +#endif catch (std::bad_alloc) { - LL_DEBUGS("UNZIP") << "Failed to allocate for string" << LL_ENDL; free(result); - return false; + return ZR_MEM_ERROR; } if (!LLSDSerialize::fromBinary(data, istr, cur_size)) { - LL_WARNS("UNZIP") << "Failed to unzip LLSD block" << LL_ENDL; free(result); - return false; + return ZR_PARSE_ERROR; } } free(result); - return true; + return ZR_OK; } //This unzip function will only work with a gzip header and trailer - while the contents //of the actual compressed data is the same for either format (gzip vs zlib ), the headers diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 23a0c8cfb1..9f58d44fe7 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -814,8 +814,24 @@ public: } }; +class LL_COMMON_API LLUZipHelper : public LLRefCount +{ +public: + typedef enum e_zip_result + { + ZR_OK = 0, + ZR_MEM_ERROR, + ZR_SIZE_ERROR, + ZR_DATA_ERROR, + ZR_PARSE_ERROR, + } EZipRresult; + // return OK or reason for failure + static EZipRresult unzip_llsd(LLSD& data, std::istream& is, S32 size); +}; + //dirty little zip functions -- yell at davep LL_COMMON_API std::string zip_llsd(LLSD& data); -LL_COMMON_API bool unzip_llsd(LLSD& data, std::istream& is, S32 size); + + LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size); #endif // LL_LLSDSERIALIZE_H -- cgit v1.2.3 From b10e46167b7aa3b44c4d2fb3fcdcbdc4f6e11096 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 29 Jan 2018 12:40:44 +0000 Subject: MAINT-8234 Mesh tread protections and removed unnecessary try in staticRun() --- indra/llcommon/llthread.cpp | 58 ++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index b96b2ce4bc..e353230791 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -129,50 +129,32 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap sThreadID = threadp->mID; - try + // Run the user supplied function + do { - // Run the user supplied function - do + try { - try - { - threadp->run(); - } - catch (const LLContinueError &e) - { - LL_WARNS("THREAD") << "ContinueException on thread '" << threadp->mName << - "' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL; - //output possible call stacks to log file. - LLError::LLCallStacks::print(); - - LOG_UNHANDLED_EXCEPTION("LLThread"); - continue; - } - break; - - } while (true); + threadp->run(); + } + catch (const LLContinueError &e) + { + LL_WARNS("THREAD") << "ContinueException on thread '" << threadp->mName << + "' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL; + //output possible call stacks to log file. + LLError::LLCallStacks::print(); - //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL; + LOG_UNHANDLED_EXCEPTION("LLThread"); + continue; + } + break; - // We're done with the run function, this thread is done executing now. - //NB: we are using this flag to sync across threads...we really need memory barriers here - threadp->mStatus = STOPPED; - } - catch (std::bad_alloc) - { - threadp->mStatus = CRASHED; - LLMemory::logMemoryInfo(TRUE); + } while (true); - //output possible call stacks to log file. - LLError::LLCallStacks::print(); + //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL; - LL_ERRS("THREAD") << "Bad memory allocation in LLThread::staticRun() named '" << threadp->mName << "'!" << LL_ENDL; - } - catch (...) - { - threadp->mStatus = CRASHED; - CRASH_ON_UNHANDLED_EXCEPTION("LLThread"); - } + // We're done with the run function, this thread is done executing now. + //NB: we are using this flag to sync across threads...we really need memory barriers here + threadp->mStatus = STOPPED; delete threadp->mRecorder; threadp->mRecorder = NULL; -- cgit v1.2.3