MD3: Fix crash on invalid vertex index
parent
b0f453dba8
commit
da0b180901
|
@ -1000,9 +1000,13 @@ void MD3Importer::InternReadFile( const std::string& pFile,
|
|||
|
||||
// Read vertices
|
||||
aiVector3D& vec = pcMesh->mVertices[iCurrent];
|
||||
vec.x = pcVertices[ pcTriangles->INDEXES[c]].X*AI_MD3_XYZ_SCALE;
|
||||
vec.y = pcVertices[ pcTriangles->INDEXES[c]].Y*AI_MD3_XYZ_SCALE;
|
||||
vec.z = pcVertices[ pcTriangles->INDEXES[c]].Z*AI_MD3_XYZ_SCALE;
|
||||
uint32_t index = pcTriangles->INDEXES[c];
|
||||
if (index >= pcSurfaces->NUM_VERTICES) {
|
||||
throw DeadlyImportError( "MD3: Invalid vertex index");
|
||||
}
|
||||
vec.x = pcVertices[index].X*AI_MD3_XYZ_SCALE;
|
||||
vec.y = pcVertices[index].Y*AI_MD3_XYZ_SCALE;
|
||||
vec.z = pcVertices[index].Z*AI_MD3_XYZ_SCALE;
|
||||
|
||||
// Convert the normal vector to uncompressed float3 format
|
||||
aiVector3D& nor = pcMesh->mNormals[iCurrent];
|
||||
|
|
Loading…
Reference in New Issue