diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index e0b2aa87c2e5f9d0ee60bee3d5ebf6799f074513..9ed60ad1216e997d86cbd85a9d11488f21ede1be 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 <map>
+
+struct mem_info {
+	std::map<void*, void*> 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<void*, void*>(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 7d1d541a4b6b40cb6b03da8b4e6764d7357f158c..c4c9cc0566151cd3e15d9482a904eb76dfc64c63 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -94,32 +94,44 @@ template <typename T> 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 e0e905638079cad672f6e3adf61e7d81a0316a41..8d826cbc6e9318b985878927b52b2fdd6b1a762e 100755
--- a/indra/llcommon/llstacktrace.cpp
+++ b/indra/llcommon/llstacktrace.cpp
@@ -125,6 +125,30 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
 	return false;
 }
 
+void ll_get_stack_trace_internal(std::vector<std::string>& 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<std::string>& lines)
@@ -132,5 +156,10 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
 	return false;
 }
 
+void ll_get_stack_trace2(std::vector<std::string>& lines)
+{
+	return false;
+}
+
 #endif
 
diff --git a/indra/llcommon/llstacktrace.h b/indra/llcommon/llstacktrace.h
index ca72c64c5d61f6f94fd44fe1cc5005d6f8138259..335765386a0481a1d0892834831f5a5fe0454de0 100755
--- a/indra/llcommon/llstacktrace.h
+++ b/indra/llcommon/llstacktrace.h
@@ -33,6 +33,7 @@
 #include <string>
 
 LL_COMMON_API bool ll_get_stack_trace(std::vector<std::string>& lines);
+LL_COMMON_API void ll_get_stack_trace_internal(std::vector<std::string>& lines);
 
 #endif
 
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index b4ac1dec73e7088fc8354b68ef7017561bc73b00..7f39e58f7127f0ba81f9d459a531ca1bbd99eb71 100755
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -559,6 +559,7 @@ inline void ll_remove_outliers(std::vector<VEC_TYPE>& data, F32 k)
 
 inline void	ll_nn2d_interpolation(const U8 *const src, U32 srcW, U32 srcH, U8 srcCh, U8 *const dst, U32 dstW, U32 dstH, U8 dstCh)
 {
+	llassert(NULL != src && NULL != dst);
 	llassert(srcCh>=dstCh);
 
 	S32 tmp_x = 0, tmp_y = 0, tmp_x1 = 0, tmp_x2 = 0;
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index d9a68cb577a33c8b75247b0d3d9c261034cd0da5..98ff36c363fd2d987a11b339f7c348dd607e6670 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -6284,6 +6284,8 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
 	num_vertices = mNumS*mNumT;
 	num_indices = (mNumS-1)*(mNumT-1)*6;
 
+	partial_build = (num_vertices > mNumVertices || num_indices > mNumIndices) ? FALSE : partial_build;
+
 	if (!partial_build)
 	{
 		resizeVertices(num_vertices);