Skip to content

Commit

Permalink
Fix memory corruption and assert failures in convex decomposition
Browse files Browse the repository at this point in the history
This PR fixes how triangular faces are decomposed into vertices and indices. The pre-increment resulted in the indices table skipping entry 0 and potentially overrunning the end of the vertices vector.
  • Loading branch information
Malcolmnixon committed Dec 1, 2023
1 parent 4c96e96 commit bf7cdc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/resources/importer_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ Vector<Ref<Shape3D>> ImporterMesh::convex_decompose(const Ref<MeshConvexDecompos
if (found_vertex) {
index = found_vertex->value;
} else {
index = ++vertex_count;
index = vertex_count++;
vertex_map[vertex] = index;
vertex_w[index] = vertex;
}
Expand Down

0 comments on commit bf7cdc5

Please sign in to comment.