summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNicky <none@none>2012-06-17 18:20:30 +0200
committerNicky <none@none>2012-06-17 18:20:30 +0200
commitd40a620483729d87bb7bca5de42d338f32ab09dc (patch)
treebd31ea8af8d4db603df830de0478e31494a7a99a /indra/newview
parentd1e924a71ef8ce41ba43bba1fbc1e1825401625c (diff)
Don't reference any LLFace via LLDrawable::getFace whose index is out
of bounds.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvovolume.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 49513eb206..8465a9dadd 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1342,7 +1342,8 @@ BOOL LLVOVolume::setDrawableParent(LLDrawable* parentp)
void LLVOVolume::updateFaceFlags()
{
- for (S32 i = 0; i < getVolume()->getNumFaces(); i++)
+ // There's no guarantee that getVolume()->getNumFaces() == mDrawable->getNumFaces()
+ for (S32 i = 0; i < getVolume()->getNumFaces() && i < mDrawable->getNumFaces(); i++)
{
LLFace *face = mDrawable->getFace(i);
if (face)
@@ -1443,7 +1444,10 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)
volume = getVolume();
}
- for (S32 i = 0; i < getVolume()->getNumVolumeFaces(); i++)
+ // There's no guarantee that getVolume()->getNumFaces() == mDrawable->getNumFaces()
+ for (S32 i = 0;
+ i < getVolume()->getNumVolumeFaces() && i < mDrawable->getNumFaces() && i < getNumTEs();
+ i++)
{
LLFace *face = mDrawable->getFace(i);
if (!face)
@@ -1744,6 +1748,11 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
void LLVOVolume::updateFaceSize(S32 idx)
{
+ if( mDrawable->getNumFaces() <= idx )
+ {
+ return;
+ }
+
LLFace* facep = mDrawable->getFace(idx);
if (facep)
{
@@ -2434,7 +2443,12 @@ void LLVOVolume::addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index)
//add the face to show the media if it is in playing
if(mDrawable)
{
- LLFace* facep = mDrawable->getFace(texture_index) ;
+ LLFace* facep(NULL);
+ if( texture_index < mDrawable->getNumFaces() )
+ {
+ facep = mDrawable->getFace(texture_index) ;
+ }
+
if(facep)
{
LLViewerMediaTexture* media_tex = LLViewerTextureManager::findMediaTexture(mMediaImplList[texture_index]->getMediaTextureID()) ;