summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-02-28 21:56:25 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-02-28 21:56:25 +0200
commit1e0eafd50cc03f0796fe8678d3460aac614db603 (patch)
tree6b9efda5d63749238a786667fc2ac4c9b3fabfad /indra/llprimitive
parent1f1d762693027a0f6ce7b913bcc8984767e947be (diff)
parent6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff)
Merge branch 'master' into DRTVWR-544-maint
# Conflicts: # indra/llaudio/llstreamingaudio_fmodstudio.cpp # indra/newview/llviewerregion.cpp
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp11
-rw-r--r--indra/llprimitive/llmodel.cpp8
2 files changed, 19 insertions, 0 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index dfa29fb539..33e90555fa 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -198,6 +198,17 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
}
LLVolumeFace::VertexMapData::PointMap point_map;
+
+ if (idx_stride <= 0
+ || (pos_source && pos_offset >= idx_stride)
+ || (tc_source && tc_offset >= idx_stride)
+ || (norm_source && norm_offset >= idx_stride))
+ {
+ // Looks like these offsets should fit inside idx_stride
+ // Might be good idea to also check idx.getCount()%idx_stride != 0
+ LL_WARNS() << "Invalid pos_offset " << pos_offset << ", tc_offset " << tc_offset << " or norm_offset " << norm_offset << LL_ENDL;
+ return LLModel::BAD_ELEMENT;
+ }
for (U32 i = 0; i < idx.getCount(); i += idx_stride)
{
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index a4fd8b3c24..bb487eaaa2 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1262,6 +1262,14 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
LL_INFOS("MESHSKININFO")<<"Material of model is not a subset of reference."<<LL_ENDL;
return false;
}
+
+ if (mMaterialList.size() > ref->mMaterialList.size())
+ {
+ LL_INFOS("MESHSKININFO") << "Material of model has more materials than a reference." << LL_ENDL;
+ // We passed isMaterialListSubset, so materials are a subset, but subset isn't supposed to be
+ // larger than original and if we keep going, reordering will cause a crash
+ return false;
+ }
std::map<std::string, U32> index_map;