diff options
author | Dave Parks <davep@lindenlab.com> | 2022-12-13 16:14:05 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-12-13 16:14:05 -0600 |
commit | 9e7829c9cb140f994c9aa12dddcd4518c4c43a40 (patch) | |
tree | 01a24506c244b875bdeb402498bf3cb11658debb /indra/llmath | |
parent | 5fcfe95422b4c3a5434b3eb711cd12401d4329d3 (diff) | |
parent | a4397723b7ed1e5a8c86b104fd5a8b94da03abb9 (diff) |
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llvolume.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index a0f3b1463b..33659e6b81 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5070,6 +5070,17 @@ void LLVolumeFace::optimize(F32 angle_cutoff) { U16 index = mIndices[i]; + if (index >= mNumVertices) + { + // invalid index + // replace with a valid index to avoid crashes + index = mNumVertices - 1; + mIndices[i] = index; + + // Needs better logging + LL_DEBUGS_ONCE("LLVOLUME") << "Invalid index, substituting" << LL_ENDL; + } + LLVolumeFace::VertexData cv; getVertexData(index, cv); @@ -5452,6 +5463,17 @@ struct MikktData n[i].normalize(); tc[i].set(face->mTexCoords[idx]); + if (idx >= face->mNumVertices) + { + // invalid index + // replace with a valid index to avoid crashes + idx = face->mNumVertices - 1; + face->mIndices[i] = idx; + + // Needs better logging + LL_DEBUGS_ONCE("LLVOLUME") << "Invalid index, substituting" << LL_ENDL; + } + if (face->mWeights) { w[i].set(face->mWeights[idx].getF32ptr()); |