summaryrefslogtreecommitdiff
path: root/indra/newview/llpolymesh.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
committerDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
commit1c909afe3998778e4cc045c9ab733e8afbf7c25b (patch)
tree75c00a32a8e305280cbec253195d1113d628fc3e /indra/newview/llpolymesh.cpp
parentbc59c04653bf1404e8148a8169208b146a123b28 (diff)
svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release
Diffstat (limited to 'indra/newview/llpolymesh.cpp')
-rw-r--r--indra/newview/llpolymesh.cpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp
index c49fee6d4a..125e1d211f 100644
--- a/indra/newview/llpolymesh.cpp
+++ b/indra/newview/llpolymesh.cpp
@@ -281,6 +281,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read HasWeights flag from " << fileName << llendl;
+ return FALSE;
}
if (!isLOD())
{
@@ -295,6 +296,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read HasDetailTexCoords flag from " << fileName << llendl;
+ return FALSE;
}
//----------------------------------------------------------------
@@ -306,6 +308,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 3)
{
llerrs << "can't read Position from " << fileName << llendl;
+ return FALSE;
}
setPosition( position );
@@ -318,6 +321,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 3)
{
llerrs << "can't read RotationAngles from " << fileName << llendl;
+ return FALSE;
}
U8 rotationOrder;
@@ -326,6 +330,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read RotationOrder from " << fileName << llendl;
+ return FALSE;
}
rotationOrder = 0;
@@ -344,6 +349,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 3)
{
llerrs << "can't read Scale from " << fileName << llendl;
+ return FALSE;
}
setScale( scale );
@@ -364,6 +370,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read NumVertices from " << fileName << llendl;
+ return FALSE;
}
allocateVertexData( numVertices );
@@ -376,6 +383,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << "can't read Coordinates from " << fileName << llendl;
+ return FALSE;
}
//----------------------------------------------------------------
@@ -386,6 +394,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << " can't read Normals from " << fileName << llendl;
+ return FALSE;
}
//----------------------------------------------------------------
@@ -396,6 +405,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << " can't read Binormals from " << fileName << llendl;
+ return FALSE;
}
@@ -407,6 +417,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << "can't read TexCoords from " << fileName << llendl;
+ return FALSE;
}
//----------------------------------------------------------------
@@ -419,6 +430,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << "can't read DetailTexCoords from " << fileName << llendl;
+ return FALSE;
}
}
@@ -432,6 +444,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != numVertices)
{
llerrs << "can't read Weights from " << fileName << llendl;
+ return FALSE;
}
}
}
@@ -445,6 +458,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read NumFaces from " << fileName << llendl;
+ return FALSE;
}
allocateFaceData( numFaces );
@@ -462,6 +476,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 3)
{
llerrs << "can't read Face[" << i << "] from " << fileName << llendl;
+ return FALSE;
}
if (mReferenceData)
{
@@ -518,6 +533,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
if (numRead != 1)
{
llerrs << "can't read NumSkinJoints from " << fileName << llendl;
+ return FALSE;
}
allocateJointNames( numSkinJoints );
}
@@ -527,11 +543,13 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
//----------------------------------------------------------------
for (i=0; i < numSkinJoints; i++)
{
- char jointName[64]; /*Flawfinder: ignore*/
- numRead = fread(jointName, sizeof(jointName), 1, fp);
+ char jointName[64+1];
+ numRead = fread(jointName, sizeof(jointName)-1, 1, fp);
+ jointName[sizeof(jointName)-1] = '\0'; // ensure nul-termination
if (numRead != 1)
{
llerrs << "can't read Skin[" << i << "].Name from " << fileName << llendl;
+ return FALSE;
}
std::string *jn = &mJointNames[i];
@@ -541,7 +559,8 @@ BOOL LLPolyMeshSharedData::loadMesh( const char *fileName )
//-------------------------------------------------------------------------
// look for morph section
//-------------------------------------------------------------------------
- char morphName[64]; /*Flawfinder: ignore*/
+ char morphName[64+1];
+ morphName[sizeof(morphName)-1] = '\0'; // ensure nul-termination
while(fread(&morphName, sizeof(char), 64, fp) == 64)
{
if (!strcmp(morphName, "End Morphs"))
@@ -971,6 +990,13 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
+ if (NULL == skeletalParam)
+ {
+ llwarns << "Failed to getChildByName(\"param_skeleton\")"
+ << llendl;
+ return FALSE;
+ }
+
for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
{
if (bone->hasName("bone"))