Fix memory corruption and assert failures in convex decomposition

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.

(cherry picked from commit bf7cdc5229)
This commit is contained in:
Malcolm Nixon 2023-12-01 16:38:08 -05:00 committed by Rémi Verschelde
parent 492b0c322a
commit 51816380b5
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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;
}