Fix out of bound access

kimkulling/fuzzer_ply_out_of_bounds_access
Kim Kulling 2024-07-03 21:05:53 +02:00
parent 625528d02c
commit 614911bb3b
1 changed files with 4 additions and 0 deletions

View File

@ -564,6 +564,10 @@ void PLYImporter::LoadFace(const PLY::Element *pcElement, const PLY::ElementInst
if (mGeneratedMesh->mFaces == nullptr) { if (mGeneratedMesh->mFaces == nullptr) {
mGeneratedMesh->mNumFaces = pcElement->NumOccur; mGeneratedMesh->mNumFaces = pcElement->NumOccur;
mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces]; mGeneratedMesh->mFaces = new aiFace[mGeneratedMesh->mNumFaces];
} else {
if (mGeneratedMesh->mNumFaces < pcElement->NumOccur) {
throw DeadlyImportError("Invalid .ply file: Too many faces");
}
} }
if (!bIsTriStrip) { if (!bIsTriStrip) {