[Bf-blender-cvs] [354ecc2f1e3] master: Fix T89269: Memory corruption during extrusions of overlapping edges

Germano Cavalcante noreply at git.blender.org
Wed Jun 23 16:37:43 CEST 2021


Commit: 354ecc2f1e3a23edb6987b59257a60239b6c68c7
Author: Germano Cavalcante
Date:   Wed Jun 23 11:33:19 2021 -0300
Branches: master
https://developer.blender.org/rB354ecc2f1e3a23edb6987b59257a60239b6c68c7

Fix T89269: Memory corruption during extrusions of overlapping edges

The "extrude" operator with the "use_dissolve_ortho_edges" option assumed
the edges were connected.

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

M	source/blender/bmesh/operators/bmo_extrude.c

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

diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 0a08b340e87..ffdce943d9f 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -459,8 +459,10 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
     }
 
     /* Allocate array to store possible vertices that will be dissolved. */
-    int boundary_verts_len = BMO_slot_map_count(dupeop.slots_out, "boundary_map.out");
-    dissolve_verts = MEM_mallocN((size_t)boundary_verts_len * sizeof(*dissolve_verts), __func__);
+    int boundary_edges_len = BMO_slot_map_count(dupeop.slots_out, "boundary_map.out");
+    /* We do not know the real number of boundary vertices. */
+    int boundary_verts_len_maybe = 2 * boundary_edges_len;
+    dissolve_verts = MEM_mallocN(boundary_verts_len_maybe * sizeof(*dissolve_verts), __func__);
   }
 
   BMO_slot_copy(&dupeop, slots_out, "geom.out", op, slots_out, "geom.out");



More information about the Bf-blender-cvs mailing list