summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-17 21:46:43 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-17 22:03:38 +0200
commitcba1daaf6be4dfd031cd10d9aea07c7124d32726 (patch)
tree34da2cdfb9b249f52a9cd37a85484869072cdced /indra/newview
parent5ccdcf51a3b4cb46a8c9134636bc3bd5f2129f92 (diff)
SL-16226 Fix crash with extra large faces
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmodelpreview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index f6edbf6bc6..6a827207ae 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -1373,7 +1373,8 @@ F32 LLModelPreview::genMeshOptimizerPerModel(LLModel *base_model, LLModel *targe
LLVector4a* buffer_positions = (LLVector4a*)ll_aligned_malloc<64>(sizeof(LLVector4a) * 2 * size_vertices + tc_bytes_size);
LLVector4a* buffer_normals = buffer_positions + size_vertices;
LLVector2* buffer_tex_coords = (LLVector2*)(buffer_normals + size_vertices);
- U16* buffer_indices = (U16*)ll_aligned_malloc_16(U16_MAX * sizeof(U16));
+ S32 buffer_idx_size = (size_indices * sizeof(U16) + 0xF) & ~0xF;
+ U16* buffer_indices = (U16*)ll_aligned_malloc_16(buffer_idx_size);
S32* old_to_new_positions_map = new S32[size_vertices];
S32 buf_positions_copied = 0;