[Bf-blender-cvs] [4946f0c5a29] blender-v2.83-release: Fix T93563: Crash subdividing with overlapping tri and quad

Campbell Barton noreply at git.blender.org
Mon Jan 17 15:56:40 CET 2022


Commit: 4946f0c5a29080a7c632fa859b456c82eb47a26a
Author: Campbell Barton
Date:   Thu Dec 2 22:39:27 2021 +1100
Branches: blender-v2.83-release
https://developer.blender.org/rB4946f0c5a29080a7c632fa859b456c82eb47a26a

Fix T93563: Crash subdividing with overlapping tri and quad

The first loop was left out when finding the split edge boundary.

Error from f2138686d9d8c105ebf8884774fd7e4d8ff239a1.

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

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

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

diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index bf63261fd4d..19341fee7ee 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -1187,12 +1187,14 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
       vlen = BLI_array_len(loops);
 
       /* find the boundary of one of the split edges */
-      for (a = 1; a < vlen; a++) {
-        if (!BMO_vert_flag_test(bm, loops[a - 1]->v, ELE_INNER) &&
+      for (a = 0; a < vlen; a++) {
+        if (!BMO_vert_flag_test(bm, loops[a ? (a - 1) : (vlen - 1)]->v, ELE_INNER) &&
             BMO_vert_flag_test(bm, loops[a]->v, ELE_INNER)) {
           break;
         }
       }
+      /* Failure to break means there is an internal error. */
+      BLI_assert(a < vlen);
 
       if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
         b = (a + numcuts + 1) % vlen;



More information about the Bf-blender-cvs mailing list