Skip to content

Commit 5d64e64

Browse files
committed
#3285 Crash at remapIndexBuffer
1 parent 16afa19 commit 5d64e64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

indra/llmath/llvolume.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5159,7 +5159,10 @@ bool LLVolumeFace::VertexMapData::ComparePosition::operator()(const LLVector3& a
51595159
void LLVolumeFace::remap()
51605160
{
51615161
// Generate a remap buffer
5162-
std::vector<unsigned int> remap(mNumVertices);
5162+
// Documentation for meshopt_generateVertexRemapMulti claims that remap should use vertice count
5163+
// but all examples use indice count. There are out of bounds crashes when using vertice count.
5164+
// To be on the safe side use bigger of the two.
5165+
std::vector<unsigned int> remap(llmax(mNumIndices, mNumVertices));
51635166
S32 remap_vertices_count = static_cast<S32>(LLMeshOptimizer::generateRemapMultiU16(&remap[0],
51645167
mIndices,
51655168
mNumIndices,

0 commit comments

Comments
 (0)