[Bf-blender-cvs] [316ddc19e2e] soc-2021-adaptive-cloth: adaptive_cloth: fix: Mesh: split_edge_triangulate() crash when edges are realloced

ishbosamiya noreply at git.blender.org
Mon Jul 12 08:23:53 CEST 2021


Commit: 316ddc19e2e0d13d222e03e4513ce4c2193934a1
Author: ishbosamiya
Date:   Sun Jul 11 22:21:08 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB316ddc19e2e0d13d222e03e4513ce4c2193934a1

adaptive_cloth: fix: Mesh: split_edge_triangulate() crash when edges are realloced

Took the new edge index by reference instead of copy leading to wrong memory access when the edges are reallocated by the arena.

===================================================================

M	source/blender/blenkernel/BKE_cloth_remesh.hh

===================================================================

diff --git a/source/blender/blenkernel/BKE_cloth_remesh.hh b/source/blender/blenkernel/BKE_cloth_remesh.hh
index e09141441d0..bfe43f41a72 100644
--- a/source/blender/blenkernel/BKE_cloth_remesh.hh
+++ b/source/blender/blenkernel/BKE_cloth_remesh.hh
@@ -1391,12 +1391,12 @@ template<typename END, typename EVD, typename EED, typename EFD> class Mesh {
       auto &new_edge_1 = this->add_empty_edge();
       new_edge_1.verts = {edge_vert_1_b.self_index, new_vert.self_index};
       added_edges.append(new_edge_1.self_index);
-      auto &new_edge_1_index = new_edge_1.self_index;
+      auto new_edge_1_index = new_edge_1.self_index;
 
       auto &new_edge_2 = this->add_empty_edge();
       new_edge_2.verts = {new_vert.self_index, edge_vert_2_b.self_index};
       added_edges.append(new_edge_2.self_index);
-      auto &new_edge_2_index = new_edge_2.self_index;
+      auto new_edge_2_index = new_edge_2.self_index;
 
       /* Need to reinitialize edge because `add_empty_edge()` may have
        * reallocated `this->edges` */



More information about the Bf-blender-cvs mailing list