summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-10-28 01:27:18 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-10-28 01:27:18 +0300
commitbfcb1f61a82508160fcb078b03c3e4772bc156df (patch)
treed7067c3d155329befa651bd4f59e8edae6965c86
parent2e760ae7dd244db0f69a48d32f2903410b020b25 (diff)
SL-16263 RaiseException in LLVolumeFace::createSide
-rw-r--r--indra/llmath/llvolume.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index e085fa6ada..a1540840a5 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5723,7 +5723,16 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
resizeIndices(grid_size*grid_size*6);
if (!volume->isMeshAssetLoaded())
{
- mEdge.resize(grid_size*grid_size * 6);
+ S32 size = grid_size * grid_size * 6;
+ try
+ {
+ mEdge.resize(size);
+ }
+ catch (std::bad_alloc&)
+ {
+ LL_WARNS("LLVOLUME") << "Resize of mEdge to " << size << " failed" << LL_ENDL;
+ return false;
+ }
}
U16* out = mIndices;
@@ -6514,7 +6523,15 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
if (!volume->isMeshAssetLoaded())
{
- mEdge.resize(num_indices);
+ try
+ {
+ mEdge.resize(num_indices);
+ }
+ catch (std::bad_alloc&)
+ {
+ LL_WARNS("LLVOLUME") << "Resize of mEdge to " << num_indices << " failed" << LL_ENDL;
+ return false;
+ }
}
}
@@ -6742,7 +6759,15 @@ BOOL LLVolumeFace::createSide(LLVolume* volume, BOOL partial_build)
LLVector4a* norm = mNormals;
static LLAlignedArray<LLVector4a, 64> triangle_normals;
- triangle_normals.resize(count);
+ try
+ {
+ triangle_normals.resize(count);
+ }
+ catch (std::bad_alloc&)
+ {
+ LL_WARNS("LLVOLUME") << "Resize of triangle_normals to " << count << " failed" << LL_ENDL;
+ return false;
+ }
LLVector4a* output = triangle_normals.mArray;
LLVector4a* end_output = output+count;