From 5d64e644585798e90362ab0dad0969e25aca5010 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 13 Dec 2024 19:15:53 +0200 Subject: #3285 Crash at remapIndexBuffer --- indra/llmath/llvolume.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llmath') 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 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 remap(llmax(mNumIndices, mNumVertices)); S32 remap_vertices_count = static_cast(LLMeshOptimizer::generateRemapMultiU16(&remap[0], mIndices, mNumIndices, -- cgit v1.2.3