diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-23 17:33:19 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-23 17:37:35 +0300 |
commit | 354ecc2f1e3a23edb6987b59257a60239b6c68c7 (patch) | |
tree | 772a87006b88cc76ba895560808cbdb6838bac40 /source | |
parent | 157081069d3bb758f4ac442780111e76bd9247f2 (diff) |
Fix T89269: Memory corruption during extrusions of overlapping edges
The "extrude" operator with the "use_dissolve_ortho_edges" option assumed
the edges were connected.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 6 |
1 files changed, 4 insertions, 2 deletions
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"); |