Fix segfault from reading bad number of indices

This commit is contained in:
Josiah VanderZee 2022-11-14 19:34:36 -06:00
parent f1042bf4c4
commit 0216a02ed4
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") {