Browse Source

AC3D: Throw exception on too many vertices instead of crashing

Turo Lamminen 10 years ago
parent
commit
16c57ab1d3
1 changed files with 3 additions and 0 deletions
  1. 3 0
      code/ACLoader.cpp

+ 3 - 0
code/ACLoader.cpp

@@ -598,6 +598,9 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
 									face.mIndices[i] = cur++;
 									face.mIndices[i] = cur++;
 
 
 									// copy vertex positions
 									// copy vertex positions
+									if ((vertices - mesh->mVertices) >= mesh->mNumVertices) {
+										throw DeadlyImportError("AC3D: Invalid number of vertices");
+									}
 									*vertices = object.vertices[entry.first] + object.translation;
 									*vertices = object.vertices[entry.first] + object.translation;