ColladaParser: check values length (#5462)
* ColladaParser: check values length fixes: #4286 * Refactor calculation of size for data --------- Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
Copyright (c) 2006-2024, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -1786,6 +1786,10 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
|
||||
const Accessor *acc = input.mResolved;
|
||||
if (!acc->mData) {
|
||||
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource);
|
||||
const size_t dataSize = acc->mOffset + acc->mCount * acc->mStride;
|
||||
if (dataSize > acc->mData->mValues.size()) {
|
||||
throw DeadlyImportError("Not enough data for accessor");
|
||||
}
|
||||
}
|
||||
}
|
||||
// and the same for the per-index channels
|
||||
@@ -1810,6 +1814,10 @@ size_t ColladaParser::ReadPrimitives(XmlNode &node, Mesh &pMesh, std::vector<Inp
|
||||
const Accessor *acc = input.mResolved;
|
||||
if (!acc->mData) {
|
||||
acc->mData = &ResolveLibraryReference(mDataLibrary, acc->mSource);
|
||||
const size_t dataSize = acc->mOffset + acc->mCount * acc->mStride;
|
||||
if (dataSize > acc->mData->mValues.size()) {
|
||||
throw DeadlyImportError("Not enough data for accessor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user