summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-09-23 13:43:01 -0700
committerGraham Linden <graham@lindenlab.com>2013-09-23 13:43:01 -0700
commit29216ac5e725254c48711737f5c22d2ad3e5e4a2 (patch)
tree35efcbe19e2c133a320ef37d5a70759292b0bc37 /indra
parent62b3bb9df551eb1c8ae65f5d89c201f6a7cc5fe3 (diff)
MAINT-3179 fix bad indexing of position info generating false alarms on range checks, issue with free of data now allocated contig with positions instead, and added copious amounts of llwarns to error return sites so 'invalid element' will be a reason to read the log and not a tease.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llmath/llvolume.cpp6
-rwxr-xr-xindra/llprimitive/llmodel.cpp17
2 files changed, 19 insertions, 4 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index de960e5d95..2b865b4a8e 100755
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -4827,13 +4827,15 @@ void LLVolumeFace::optimize(F32 angle_cutoff)
if (angle_cutoff > 1.f && !mNormals)
{
- ll_aligned_free_16(new_face.mNormals);
+ // Now alloc'd with positions
+ //ll_aligned_free_16(new_face.mNormals);
new_face.mNormals = NULL;
}
if (!mTexCoords)
{
- ll_aligned_free_16(new_face.mTexCoords);
+ // Now alloc'd with positions
+ //ll_aligned_free_16(new_face.mTexCoords);
new_face.mTexCoords = NULL;
}
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 37f0bfcbb8..34e0483a83 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -166,6 +166,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if ( !get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source) || !pos_source )
{
+ llwarns << "Could not find dom sources for basic geo data; invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -201,6 +202,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (((i + pos_offset) > index_count)
|| ((idx[i+pos_offset]*3+2) > vertex_count))
{
+ llwarns << "Out of range index data; invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -210,6 +212,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (!cv.getPosition().isFinite3())
{
+ llwarns << "Nan positional data, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
}
@@ -222,6 +225,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (((i + tc_offset) > index_count)
|| ((idx[i+tc_offset]*2+1) > tc_count))
{
+ llwarns << "Out of range TC indices." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -242,6 +246,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (((i + norm_offset) > index_count)
|| ((idx[i+norm_offset]*3+2) > norm_count))
{
+ llwarns << "Found out of range norm indices, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -380,6 +385,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (!get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source))
{
+ llwarns << "Could not get DOM sources for basic geo data, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -430,9 +436,10 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
{
// guard against model data specifiying out of range indices or verts
//
- if (((i + pos_offset) > index_count)
- || ((idx[i+pos_offset]*3+2) > vertex_count))
+ if (((cur_idx + pos_offset) > index_count)
+ || ((idx[cur_idx+pos_offset]*3+2) > vertex_count))
{
+ llwarns << "Out of range position indices, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -455,6 +462,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (((cur_idx + tc_offset) > index_count)
|| ((idx[cur_idx+tc_offset]*2+1) > tc_count))
{
+ llwarns << "Out of range TC indices, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -475,6 +483,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (((cur_idx + norm_offset) > index_count)
|| ((idx[cur_idx+norm_offset]*3+2) > norm_count))
{
+ llwarns << "Out of range norm indices, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
@@ -653,6 +662,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
domVertices* vertices = (domVertices*) elem.cast();
if (!vertices)
{
+ llwarns << "Could not find vertex source, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
domInputLocal_Array& v_inp = vertices->getInput_array();
@@ -666,6 +676,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
domSource* src = (domSource*) elem.cast();
if (!src)
{
+ llwarns << "Could not find DOM source, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
v = &(src->getFloat_array()->getValue());
@@ -681,6 +692,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
domSource* src = (domSource*) elem.cast();
if (!src)
{
+ llwarns << "Could not find DOM source, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
n = &(src->getFloat_array()->getValue());
@@ -693,6 +705,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac
domSource* src = (domSource*) elem.cast();
if (!src)
{
+ llwarns << "Could not find DOM source, invalid model." << llendl;
return LLModel::BAD_ELEMENT;
}
t = &(src->getFloat_array()->getValue());