From 04e0552f9eda6b9efe952bd34db8fa841fc239ce Mon Sep 17 00:00:00 2001 From: wise86Android Date: Sat, 24 Sep 2016 12:33:53 +0200 Subject: [PATCH] 134062 Use after free --- code/MakeVerboseFormat.cpp | 4 +++- test/unit/utCoverityTest.cpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test/unit/utCoverityTest.cpp diff --git a/code/MakeVerboseFormat.cpp b/code/MakeVerboseFormat.cpp index df3b97a4d..be68bf3d6 100644 --- a/code/MakeVerboseFormat.cpp +++ b/code/MakeVerboseFormat.cpp @@ -168,6 +168,8 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh) } } + + // build output vertex weights for (unsigned int i = 0;i < pcMesh->mNumBones;++i) { @@ -177,11 +179,11 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh) aiVertexWeight *weightToCopy = &( newWeights[i][0] ); memcpy(pcMesh->mBones[i]->mWeights, weightToCopy, sizeof(aiVertexWeight) * newWeights[i].size()); - delete[] newWeights; } else { pcMesh->mBones[i]->mWeights = NULL; } } + delete[] newWeights; // delete the old members delete[] pcMesh->mVertices; diff --git a/test/unit/utCoverityTest.cpp b/test/unit/utCoverityTest.cpp new file mode 100644 index 000000000..eedfdf963 --- /dev/null +++ b/test/unit/utCoverityTest.cpp @@ -0,0 +1,4 @@ +// +// Created by wise on 9/24/16. +// +