From 9825d07764b9934ab2a88fa05f9f5edba4beb8e2 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 28 Oct 2015 14:20:13 +0200 Subject: [PATCH] OFFLoader: Throw error on certain invalid files instead of failing validation later --- code/OFFLoader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/OFFLoader.cpp b/code/OFFLoader.cpp index ea563ca9e..7e4429c88 100644 --- a/code/OFFLoader.cpp +++ b/code/OFFLoader.cpp @@ -225,6 +225,9 @@ void OFFImporter::InternReadFile( const std::string& pFile, ++faces; } + if (mesh->mNumVertices != verts.size()) { + throw DeadlyImportError("OFF: Vertex count mismatch"); + } mesh->mVertices = new aiVector3D[verts.size()]; memcpy(mesh->mVertices, &verts[0], verts.size() * sizeof(aiVector3D)); // generate the output node graph