From a1f983f63cfb9737cc2f182fe6fc6deff9b1ee75 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 10 Oct 2014 18:08:05 +0300 Subject: MAINT-4567 FIXED is not parsed correctly in viewer-lion --- indra/llcommon/lluriparser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index ef4481d32f..0fb004ef7e 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -175,11 +175,18 @@ S32 LLUriParser::normalize() if (!mRes) { mNormalizedUri = &label_buf[mTmpScheme ? 7 : 0]; + mTmpScheme = false; } } } } + if(mTmpScheme) + { + mNormalizedUri = mNormalizedUri.substr(7); + mTmpScheme = false; + } + return mRes; } -- cgit v1.2.3 From 2b8827a55f6a935bac8abb7513be1c00659f6ab1 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Mon, 13 Oct 2014 19:14:42 +0300 Subject: MAINT-4169 FIXED Suppress initial display of the path portion of URLs from other users and scripts --- indra/llcommon/lluriparser.cpp | 24 +++++++++++++++++++++++- indra/llcommon/lluriparser.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 0fb004ef7e..d07288f123 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -191,20 +191,42 @@ S32 LLUriParser::normalize() } void LLUriParser::glue(std::string& uri) const +{ + std::string first_part; + glueFirst(first_part); + + std::string second_part; + glueSecond(second_part); + + uri = first_part + second_part; +} + +void LLUriParser::glueFirst(std::string& uri) const { if (mScheme.size()) { uri = mScheme; uri += "://"; } + else + { + uri.clear(); + } uri += mHost; +} +void LLUriParser::glueSecond(std::string& uri) const +{ if (mPort.size()) { - uri += ':'; + uri = ':'; uri += mPort; } + else + { + uri.clear(); + } uri += mPath; diff --git a/indra/llcommon/lluriparser.h b/indra/llcommon/lluriparser.h index 719f916837..e987bae924 100644 --- a/indra/llcommon/lluriparser.h +++ b/indra/llcommon/lluriparser.h @@ -60,6 +60,8 @@ public: void extractParts(); void glue(std::string& uri) const; + void glueFirst(std::string& uri) const; + void glueSecond(std::string& uri) const; bool test() const; S32 normalize(); -- cgit v1.2.3 From 366bcd0cbca43081fe58825fd463018e49b51740 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 27 Oct 2014 17:10:08 +0200 Subject: MAINT-4435 FIXED fix in llvolume.cpp Perform full build if number of vertices less than allowed. Changes in all other files relate auxiliary methods for catching similar bugs in future. --- indra/llcommon/llmemory.cpp | 78 +++++++++++++++++++++++++++++++++++++---- indra/llcommon/llmemory.h | 54 +++++++++++++++++----------- indra/llcommon/llstacktrace.cpp | 29 +++++++++++++++ indra/llcommon/llstacktrace.h | 1 + 4 files changed, 134 insertions(+), 28 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index e0b2aa87c2..9ed60ad121 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -63,13 +63,18 @@ LLPrivateMemoryPoolManager::mem_allocation_info_t LLPrivateMemoryPoolManager::sM void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) { -#ifdef SHOW_ASSERT - // Redundant, place to set breakpoints. - if (ptr%alignment!=0) - { - LL_WARNS() << "alignment check failed" << LL_ENDL; - } - llassert(ptr%alignment==0); +#if defined(LL_WINDOWS) && defined(LL_DEBUG_BUFFER_OVERRUN) + //do not check + return; +#else + #ifdef SHOW_ASSERT + // Redundant, place to set breakpoints. + if (ptr%alignment!=0) + { + LL_WARNS() << "alignment check failed" << LL_ENDL; + } + llassert(ptr%alignment==0); + #endif #endif } @@ -2148,3 +2153,62 @@ void LLPrivateMemoryPoolTester::fragmentationtest() } #endif //-------------------------------------------------------------------- + +#if defined(LL_WINDOWS) && defined(LL_DEBUG_BUFFER_OVERRUN) + +#include + +struct mem_info { + std::map memory_info; + LLMutex mutex; + + static mem_info& get() { + static mem_info instance; + return instance; + } + +private: + mem_info(){} +}; + +void* ll_aligned_malloc_fallback( size_t size, int align ) +{ + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + + unsigned int for_alloc = sysinfo.dwPageSize; + while(for_alloc < size) for_alloc += sysinfo.dwPageSize; + + void *p = VirtualAlloc(NULL, for_alloc+sysinfo.dwPageSize, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE); + if(NULL == p) { + // call debugger + __asm int 3; + } + memset(p, 0xaa, for_alloc); + memset((void*)((char*)p + for_alloc), 0xbb, sysinfo.dwPageSize); + DWORD old; + BOOL Res = VirtualProtect((void*)((char*)p + for_alloc), sysinfo.dwPageSize, PAGE_NOACCESS, &old); + if(FALSE == Res) { + // call debugger + __asm int 3; + } + + void* ret = (void*)((char*)p + for_alloc-size); + + { + LLMutexLock lock(&mem_info::get().mutex); + mem_info::get().memory_info.insert(std::pair(ret, p)); + } + + + return ret; +} + +void ll_aligned_free_fallback( void* ptr ) +{ + LLMutexLock lock(&mem_info::get().mutex); + VirtualFree(mem_info::get().memory_info.find(ptr)->second, 0, MEM_RELEASE); + mem_info::get().memory_info.erase(ptr); +} + +#endif diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 7d1d541a4b..c4c9cc0566 100755 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -94,32 +94,44 @@ template T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) #define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16) - -inline void* ll_aligned_malloc_fallback( size_t size, int align ) -{ -#if defined(LL_WINDOWS) - return _aligned_malloc(size, align); +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ + // for enable buffer overrun detection predefine LL_DEBUG_BUFFER_OVERRUN in current library + // change preprocessro code to: #if 1 && defined(LL_WINDOWS) + +#if 0 && defined(LL_WINDOWS) + void* ll_aligned_malloc_fallback( size_t size, int align ); + void ll_aligned_free_fallback( void* ptr ); +//------------------------------------------------------------------------------------------------ #else - void* mem = malloc( size + (align - 1) + sizeof(void*) ); - char* aligned = ((char*)mem) + sizeof(void*); - aligned += align - ((uintptr_t)aligned & (align - 1)); - - ((void**)aligned)[-1] = mem; - return aligned; -#endif -} + inline void* ll_aligned_malloc_fallback( size_t size, int align ) + { + #if defined(LL_WINDOWS) + return _aligned_malloc(size, align); + #else + void* mem = malloc( size + (align - 1) + sizeof(void*) ); + char* aligned = ((char*)mem) + sizeof(void*); + aligned += align - ((uintptr_t)aligned & (align - 1)); + + ((void**)aligned)[-1] = mem; + return aligned; + #endif + } -inline void ll_aligned_free_fallback( void* ptr ) -{ -#if defined(LL_WINDOWS) - _aligned_free(ptr); -#else - if (ptr) + inline void ll_aligned_free_fallback( void* ptr ) { - free( ((void**)ptr)[-1] ); + #if defined(LL_WINDOWS) + _aligned_free(ptr); + #else + if (ptr) + { + free( ((void**)ptr)[-1] ); + } + #endif } #endif -} +//------------------------------------------------------------------------------------------------ +//------------------------------------------------------------------------------------------------ #if !LL_USE_TCMALLOC inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16(). diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index e0e9056380..8d826cbc6e 100755 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -125,6 +125,30 @@ bool ll_get_stack_trace(std::vector& lines) return false; } +void ll_get_stack_trace_internal(std::vector& lines) +{ + const S32 MAX_STACK_DEPTH = 100; + const S32 STRING_NAME_LENGTH = 256; + + HANDLE process = GetCurrentProcess(); + SymInitialize( process, NULL, TRUE ); + + void *stack[MAX_STACK_DEPTH]; + + unsigned short frames = RtlCaptureStackBackTrace_fn( 0, MAX_STACK_DEPTH, stack, NULL ); + SYMBOL_INFO *symbol = (SYMBOL_INFO*)calloc(sizeof(SYMBOL_INFO) + STRING_NAME_LENGTH * sizeof(char), 1); + symbol->MaxNameLen = STRING_NAME_LENGTH-1; + symbol->SizeOfStruct = sizeof(SYMBOL_INFO); + + for(unsigned int i = 0; i < frames; i++) + { + SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); + lines.push_back(symbol->Name); + } + + free( symbol ); +} + #else bool ll_get_stack_trace(std::vector& lines) @@ -132,5 +156,10 @@ bool ll_get_stack_trace(std::vector& lines) return false; } +void ll_get_stack_trace2(std::vector& lines) +{ + return false; +} + #endif diff --git a/indra/llcommon/llstacktrace.h b/indra/llcommon/llstacktrace.h index ca72c64c5d..335765386a 100755 --- a/indra/llcommon/llstacktrace.h +++ b/indra/llcommon/llstacktrace.h @@ -33,6 +33,7 @@ #include LL_COMMON_API bool ll_get_stack_trace(std::vector& lines); +LL_COMMON_API void ll_get_stack_trace_internal(std::vector& lines); #endif -- cgit v1.2.3 From edb7e3450f16bbda7a30ff56a350e0060cb0e623 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Tue, 28 Oct 2014 17:12:49 +0200 Subject: MAINT-4435 FIXED build fix patchset2 --- indra/llcommon/llmemory.cpp | 2 -- indra/llcommon/llstacktrace.cpp | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 9ed60ad121..ae11988df8 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -2184,8 +2184,6 @@ void* ll_aligned_malloc_fallback( size_t size, int align ) // call debugger __asm int 3; } - memset(p, 0xaa, for_alloc); - memset((void*)((char*)p + for_alloc), 0xbb, sysinfo.dwPageSize); DWORD old; BOOL Res = VirtualProtect((void*)((char*)p + for_alloc), sysinfo.dwPageSize, PAGE_NOACCESS, &old); if(FALSE == Res) { diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index 8d826cbc6e..bbf0e1e141 100755 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -156,9 +156,9 @@ bool ll_get_stack_trace(std::vector& lines) return false; } -void ll_get_stack_trace2(std::vector& lines) +void ll_get_stack_trace_internal(std::vector& lines) { - return false; + } #endif -- cgit v1.2.3 From 799d13269a5cdf29a5d68c15ceac42f0407b5833 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 3 Nov 2014 20:05:20 +0200 Subject: MAINT-3585 FIXED Viewer Crashes when attempting to upload image. The bug was fixed, the reasone of crash is following. The Core Flow view contain another GL context and will not care about restoring a previous. I restore context manually. This path also contain a minor changes in another files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All changes described here. Сhange's for fix current bug. indra/llwindow/llwindow.h indra/llwindow/llwindowheadless.h indra/llwindow/llwindowmacosx.h indra/llwindow/llwindowsdl.h indra/llwindow/llwindowwin32.h indra/newview/lllocalbitmaps.cpp indra/newview/llviewerdisplay.cpp indra/newview/llviewerdisplay.h Twice mUsage initialization (replace to forward initialization). indra/llcharacter/lljointstate.h Looks like condition should be befor memcopy call, otherwise - possible CRASH. indra/llcommon/llmd5.cpp Unused condition and variables. indra/llmath/llsphere.cpp Looks like should be under if otherwise - possible CRASH indra\llprimitive\llmodel.cpp Useless assert's. indra/llrender/llrender.cpp indra/newview/lldaycyclemanager.cpp --- indra/llcommon/llmd5.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index ed80af36d8..f942a976b7 100755 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -118,6 +118,12 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { buffer_space = 64 - buffer_index; // how much space is left in buffer + // now, transform each 64-byte piece of the input, bypassing the buffer + if (input == NULL || input_length == 0){ + std::cerr << "LLMD5::update: Invalid input!" << std::endl; + return; + } + // Transform as many times as possible. if (input_length >= buffer_space) { // ie. we have enough to fill the buffer // fill the rest of the buffer and transform @@ -127,12 +133,6 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { buffer_space); transform (buffer); - // now, transform each 64-byte piece of the input, bypassing the buffer - if (input == NULL || input_length == 0){ - std::cerr << "LLMD5::update: Invalid input!" << std::endl; - return; - } - for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64) transform (input+input_index); -- cgit v1.2.3 From 18bacca5ca066c6fb1b38a82e322b624923b7340 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 24 Mar 2015 18:30:40 +0200 Subject: MAINT-5023 URIparser crash in LLUrlEntryBase::urlToLabelWithGreyQuery --- indra/llcommon/lluriparser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index d07288f123..08b19c56e0 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -118,6 +118,12 @@ void LLUriParser::fragment(const std::string& s) void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) { + if(&textRange == NULL) + { + LL_WARNS() << "textRange is NULL for uri: " << mNormalizedUri << LL_ENDL; + return; + } + S32 len = textRange.afterLast - textRange.first; if (len) { @@ -128,6 +134,12 @@ void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) void LLUriParser::extractParts() { + if(&mUri == NULL) + { + LL_WARNS() << "mUri is NULL for uri: " << mNormalizedUri << LL_ENDL; + return; + } + if (mTmpScheme) { mScheme.clear(); -- cgit v1.2.3 From b10940e8e38db7c7fc4adbd73ad8a56dec2b58f3 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 27 Mar 2015 11:23:58 +0200 Subject: MAINT-5019 FIXED Undesired http:// added to domains sent in chat --- indra/llcommon/lluriparser.cpp | 5 +++-- indra/llcommon/lluriparser.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 08b19c56e0..e24e53426e 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -29,7 +29,7 @@ #include "linden_common.h" #include "lluriparser.h" -LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mRes(0) +LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedTmp(false), mRes(0) { mState.uri = &mUri; @@ -140,7 +140,7 @@ void LLUriParser::extractParts() return; } - if (mTmpScheme) + if (mTmpScheme || mNormalizedTmp) { mScheme.clear(); } @@ -169,6 +169,7 @@ void LLUriParser::extractParts() S32 LLUriParser::normalize() { + mNormalizedTmp = mTmpScheme; if (!mRes) { mRes = uriNormalizeSyntaxExA(&mUri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST); diff --git a/indra/llcommon/lluriparser.h b/indra/llcommon/lluriparser.h index e987bae924..561431e8f9 100644 --- a/indra/llcommon/lluriparser.h +++ b/indra/llcommon/lluriparser.h @@ -81,6 +81,7 @@ private: S32 mRes; bool mTmpScheme; + bool mNormalizedTmp; }; #endif // LL_LLURIPARSER_H -- cgit v1.2.3 From e03f1521c82545a49b289d624c8b26be3d1fb3d6 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 2 Apr 2015 11:50:17 +0300 Subject: MAINT-5023 URIparser crash in LLUrlEntryBase::urlToLabelWithGreyQuery --- indra/llcommon/lluriparser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index e24e53426e..8c456ee879 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -124,6 +124,18 @@ void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) return; } + if(textRange.first == NULL) + { + LL_WARNS() << "textRange.first is NULL for uri: " << mNormalizedUri << LL_ENDL; + return; + } + + if(textRange.afterLast == NULL) + { + LL_WARNS() << "textRange.afterLast is NULL for uri: " << mNormalizedUri << LL_ENDL; + return; + } + S32 len = textRange.afterLast - textRange.first; if (len) { -- cgit v1.2.3 From dbb304ab2032153bbd2e5bdd589f6ed72d70a0a1 Mon Sep 17 00:00:00 2001 From: MNikolenko ProductEngine Date: Tue, 7 Apr 2015 20:58:48 +0300 Subject: MAINT-5023 FIXED URIparser crash in LLUrlEntryBase::urlToLabelWithGreyQuery --- indra/llcommon/lluriparser.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp index 8c456ee879..8270c630d8 100644 --- a/indra/llcommon/lluriparser.cpp +++ b/indra/llcommon/lluriparser.cpp @@ -118,29 +118,27 @@ void LLUriParser::fragment(const std::string& s) void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str) { + str = ""; + if(&textRange == NULL) { - LL_WARNS() << "textRange is NULL for uri: " << mNormalizedUri << LL_ENDL; return; } if(textRange.first == NULL) { - LL_WARNS() << "textRange.first is NULL for uri: " << mNormalizedUri << LL_ENDL; return; } if(textRange.afterLast == NULL) { - LL_WARNS() << "textRange.afterLast is NULL for uri: " << mNormalizedUri << LL_ENDL; return; } S32 len = textRange.afterLast - textRange.first; if (len) { - str = textRange.first; - str = str.substr(0, len); + str.assign(textRange.first, len); } } -- cgit v1.2.3