summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-12-13 19:15:53 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-12-13 21:07:05 +0200
commit5d64e644585798e90362ab0dad0969e25aca5010 (patch)
treedbc4a0a64601807e74c62aaaa90f35adedd185d0 /indra/llmath
parent16afa19b90fc11a8e2c7e0b414f4088419d16af4 (diff)
#3285 Crash at remapIndexBuffer
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llvolume.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 700e61467b..44b6e7923b 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5159,7 +5159,10 @@ bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a
void LLVolumeFace::remap()
{
// Generate a remap buffer
- std::vector<unsigned int> remap(mNumVertices);
+ // Documentation for meshopt_generateVertexRemapMulti claims that remap should use vertice count
+ // but all examples use indice count. There are out of bounds crashes when using vertice count.
+ // To be on the safe side use bigger of the two.
+ std::vector<unsigned int> remap(llmax(mNumIndices, mNumVertices));
S32 remap_vertices_count = static_cast<S32>(LLMeshOptimizer::generateRemapMultiU16(&remap[0],
mIndices,
mNumIndices,