Fix index out of bounds

pull/4971/head
Johan Mattsson 2023-02-20 19:56:57 +01:00 committed by GitHub
parent ad2f0682e7
commit fa4273ee1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -486,7 +486,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
for (unsigned int j = 0,n = 0; j < m->mNumFaces; ++j) { for (unsigned int j = 0,n = 0; j < m->mNumFaces; ++j) {
aiFace& f = m->mFaces[j]; aiFace& f = m->mFaces[j];
if (g.triangles[j]>triangles.size()) { if (g.triangles[j] >= triangles.size()) {
throw DeadlyImportError("MS3D: Encountered invalid triangle index, file is malformed"); throw DeadlyImportError("MS3D: Encountered invalid triangle index, file is malformed");
} }
@ -494,7 +494,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
f.mIndices = new unsigned int[f.mNumIndices=3]; f.mIndices = new unsigned int[f.mNumIndices=3];
for (unsigned int k = 0; k < 3; ++k,++n) { for (unsigned int k = 0; k < 3; ++k,++n) {
if (t.indices[k]>vertices.size()) { if (t.indices[k] >= vertices.size()) {
throw DeadlyImportError("MS3D: Encountered invalid vertex index, file is malformed"); throw DeadlyImportError("MS3D: Encountered invalid vertex index, file is malformed");
} }