What: Throw instead of assert when input file is invalid.
Why: Assimp shouldn't crash on invalid files. Asserts are disabled on Release builds.pull/3394/head
parent
4f30b2aa5c
commit
615ffdf93f
|
@ -731,8 +731,14 @@ void Accessor::ExtractData(T *&outData) {
|
|||
const size_t stride = bufferView && bufferView->byteStride ? bufferView->byteStride : elemSize;
|
||||
|
||||
const size_t targetElemSize = sizeof(T);
|
||||
ai_assert(elemSize <= targetElemSize);
|
||||
ai_assert(count * stride <= (bufferView ? bufferView->byteLength : sparse->data.size()));
|
||||
|
||||
if (elemSize > targetElemSize) {
|
||||
throw DeadlyImportError("GLTF: elemSize > targetElemSize");
|
||||
}
|
||||
|
||||
if (count*stride > (bufferView ? bufferView->byteLength : sparse->data.size())) {
|
||||
throw DeadlyImportError("GLTF: count*stride out of range");
|
||||
}
|
||||
|
||||
outData = new T[count];
|
||||
if (stride == elemSize && targetElemSize == elemSize) {
|
||||
|
|
Loading…
Reference in New Issue