summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Linden <none@none>2014-09-23 19:12:35 -0700
committerRichard Linden <none@none>2014-09-23 19:12:35 -0700
commite298325bed05f0f37fd134b72c68cce186475f23 (patch)
tree42cd360632c84f3940125f7392e5634709041eed
parent90467f699fba557c6ab1bf42c677bead2adc5aef (diff)
MAINT-4481 FIX [viewer-lion] Linux build fails due array-bounds issue in llmanipscale.cpp
This was an out of bounds array access on a code path not normally accessed To test, set debug setting ScaleShowAxes to true, go into build mode, and hold down Ctrl+Shift to scale an object There should be colored bars along the scale axes, limited to the bounds of the object's extents
-rwxr-xr-xindra/llprimitive/llmodel.cpp4
-rwxr-xr-xindra/newview/llmanipscale.cpp52
-rwxr-xr-xindra/newview/llmanipscale.h1
3 files changed, 13 insertions, 44 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index b4963225dc..b19df0200d 100755
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -172,7 +172,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if (!pos_source)
{
- llwarns << "Unable to process mesh without position data; invalid model; invalid model." << llendl;
+ LL_WARNS() << "Unable to process mesh without position data; invalid model; invalid model." << LL_ENDL;
return LLModel::BAD_ELEMENT;
}
@@ -193,7 +193,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
if ((vertex_count == 0) || (tc_count == 0))
{
- llwarns << "Unable to process mesh with empty position array; invalid model." << llendl;
+ LL_WARNS() << "Unable to process mesh with empty position array; invalid model." << LL_ENDL;
return LLModel::BAD_ELEMENT;
}
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index cb505c9d4c..52222c3727 100755
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -85,7 +85,6 @@ const LLManip::EManipPart MANIPULATOR_IDS[LLManipScale::NUM_MANIPULATORS] =
LLManip::LL_FACE_NEGZ
};
-
F32 get_default_max_prim_scale(bool is_flora)
{
// a bit of a hack, but if it's foilage, we don't want to use the
@@ -292,10 +291,6 @@ void LLManipScale::render()
LLGLEnable poly_offset(GL_POLYGON_OFFSET_FILL);
glPolygonOffset( -2.f, -2.f);
- // JC - Band-aid until edge stretch working similar to side stretch
- // in non-uniform.
- // renderEdges( bbox );
-
renderCorners( bbox );
renderFaces( bbox );
@@ -693,63 +688,38 @@ void LLManipScale::renderFaces( const LLBBox& bbox )
{
case 0:
conditionalHighlight( LL_FACE_POSZ, &z_highlight_color, &z_normal_color );
- renderAxisHandle( LL_FACE_POSZ, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], max.mV[VZ] ) );
+ renderAxisHandle( 8, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], max.mV[VZ] ) );
break;
case 1:
conditionalHighlight( LL_FACE_POSX, &x_highlight_color, &x_normal_color );
- renderAxisHandle( LL_FACE_POSX, ctr, LLVector3( max.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
+ renderAxisHandle( 9, ctr, LLVector3( max.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
break;
case 2:
conditionalHighlight( LL_FACE_POSY, &y_highlight_color, &y_normal_color );
- renderAxisHandle( LL_FACE_POSY, ctr, LLVector3( ctr.mV[VX], max.mV[VY], ctr.mV[VZ] ) );
+ renderAxisHandle( 10, ctr, LLVector3( ctr.mV[VX], max.mV[VY], ctr.mV[VZ] ) );
break;
case 3:
conditionalHighlight( LL_FACE_NEGX, &x_highlight_color, &x_normal_color );
- renderAxisHandle( LL_FACE_NEGX, ctr, LLVector3( min.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
+ renderAxisHandle( 11, ctr, LLVector3( min.mV[VX], ctr.mV[VY], ctr.mV[VZ] ) );
break;
case 4:
conditionalHighlight( LL_FACE_NEGY, &y_highlight_color, &y_normal_color );
- renderAxisHandle( LL_FACE_NEGY, ctr, LLVector3( ctr.mV[VX], min.mV[VY], ctr.mV[VZ] ) );
+ renderAxisHandle( 12, ctr, LLVector3( ctr.mV[VX], min.mV[VY], ctr.mV[VZ] ) );
break;
case 5:
conditionalHighlight( LL_FACE_NEGZ, &z_highlight_color, &z_normal_color );
- renderAxisHandle( LL_FACE_NEGZ, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], min.mV[VZ] ) );
+ renderAxisHandle( 13, ctr, LLVector3( ctr.mV[VX], ctr.mV[VY], min.mV[VZ] ) );
break;
}
}
}
}
-void LLManipScale::renderEdges( const LLBBox& bbox )
-{
- LLVector3 extent = bbox.getExtentLocal();
-
- for( U32 part = LL_EDGE_MIN; part <= LL_EDGE_MAX; part++ )
- {
- F32 edge_width = mBoxHandleSize[part] * .6f;
- LLVector3 direction = edgeToUnitVector( part );
- LLVector3 center_to_edge = unitVectorToLocalBBoxExtent( direction, bbox );
-
- gGL.pushMatrix();
- {
- gGL.translatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] );
- conditionalHighlight( part );
- gGL.scalef(
- direction.mV[0] ? edge_width : extent.mV[VX],
- direction.mV[1] ? edge_width : extent.mV[VY],
- direction.mV[2] ? edge_width : extent.mV[VZ] );
- gBox.render();
- }
- gGL.popMatrix();
- }
-}
-
-
void LLManipScale::renderCorners( const LLBBox& bbox )
{
U32 part = LL_CORNER_NNN;
@@ -792,14 +762,14 @@ void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z )
}
-void LLManipScale::renderAxisHandle( U32 part, const LLVector3& start, const LLVector3& end )
+void LLManipScale::renderAxisHandle( U32 handle_index, const LLVector3& start, const LLVector3& end )
{
if( getShowAxes() )
{
// Draws a single "jacks" style handle: a long, retangular box from start to end.
LLVector3 offset_start = end - start;
offset_start.normalize();
- offset_start = start + mBoxHandleSize[part] * offset_start;
+ offset_start = start + mBoxHandleSize[handle_index] * offset_start;
LLVector3 delta = end - offset_start;
LLVector3 pos = offset_start + 0.5f * delta;
@@ -808,9 +778,9 @@ void LLManipScale::renderAxisHandle( U32 part, const LLVector3& start, const LLV
{
gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] );
gGL.scalef(
- mBoxHandleSize[part] + llabs(delta.mV[VX]),
- mBoxHandleSize[part] + llabs(delta.mV[VY]),
- mBoxHandleSize[part] + llabs(delta.mV[VZ]));
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VX]),
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VY]),
+ mBoxHandleSize[handle_index] + llabs(delta.mV[VZ]));
gBox.render();
}
gGL.popMatrix();
diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h
index e93b3d4f83..11ade9b7d0 100755
--- a/indra/newview/llmanipscale.h
+++ b/indra/newview/llmanipscale.h
@@ -96,7 +96,6 @@ public:
private:
void renderCorners( const LLBBox& local_bbox );
void renderFaces( const LLBBox& local_bbox );
- void renderEdges( const LLBBox& local_bbox );
void renderBoxHandle( F32 x, F32 y, F32 z );
void renderAxisHandle( U32 part, const LLVector3& start, const LLVector3& end );
void renderGuidelinesPart( const LLBBox& local_bbox );