From e761f13c8042f6a840b8e29e77698046fc0b9a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Thu, 24 May 2018 12:07:05 +0200 Subject: [PATCH] does not access undefined memory area anymore. This will fix some Debuggers, which throw an exception, when accessing out-of-bound memory --- code/STLLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index 73a780e34..b0ace74b6 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -365,10 +365,10 @@ void STLImporter::LoadASCIIFile( aiNode *root ) { pMesh->mNumFaces = static_cast(positionBuffer.size() / 3); pMesh->mNumVertices = static_cast(positionBuffer.size()); pMesh->mVertices = new aiVector3D[pMesh->mNumVertices]; - memcpy(pMesh->mVertices, &positionBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D)); + memcpy(pMesh->mVertices, positionBuffer.data(), pMesh->mNumVertices * sizeof(aiVector3D)); positionBuffer.clear(); pMesh->mNormals = new aiVector3D[pMesh->mNumVertices]; - memcpy(pMesh->mNormals, &normalBuffer[0].x, pMesh->mNumVertices * sizeof(aiVector3D)); + memcpy(pMesh->mNormals, normalBuffer.data(), pMesh->mNumVertices * sizeof(aiVector3D)); normalBuffer.clear(); // now copy faces