Fix segfault from reading bad number of indices

This commit is contained in:
Josiah VanderZee 2022-11-14 19:34:36 -06:00 committed by JosiahWI
parent 79ffe6b6d8
commit b47858cf80
No known key found for this signature in database
GPG Key ID: C7BB8573A4ABC4B9
2 changed files with 2 additions and 1 deletions

View File

@ -194,7 +194,7 @@ static u16* getIndices(const tinygltf::Model& model,
const auto& indicesBuffer = model.buffers[view.buffer];
return readIndices(
BufferOffset(indicesBuffer.data, view.byteOffset),
model.accessors[0].count);
model.accessors[accessorId].count);
}
CGLTFMeshFileLoader::CGLTFMeshFileLoader()

View File

@ -91,6 +91,7 @@ TEST_CASE("blender cube") {
CHECK(indices[0] == 0);
CHECK(indices[1] == 3);
CHECK(indices[2] == 9);
CHECK(indices[35] == 16);
}
SECTION("vertex normals are correct") {