[Bf-blender-cvs] [283af786579] blender-v2.93-release: Fix T101591: mathutils.geometry.intersect_line_line 2D vector error

Campbell Barton noreply at git.blender.org
Wed Dec 14 14:42:42 CET 2022


Commit: 283af786579b4d5e094332a15d95a5c888647b13
Author: Campbell Barton
Date:   Thu Oct 6 17:32:11 2022 +1100
Branches: blender-v2.93-release
https://developer.blender.org/rB283af786579b4d5e094332a15d95a5c888647b13

Fix T101591: mathutils.geometry.intersect_line_line 2D vector error

Uninitialized stack memory was used when intersecting 2D vectors.

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

M	source/blender/python/mathutils/mathutils_geometry.c

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

diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 4b09c08f62c..b431c45062f 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -193,6 +193,13 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
     return NULL;
   }
 
+  /* Zero 3rd axis of 2D vectors. */
+  if (len == 2) {
+    lines[1][2] = 0.0f;
+    lines[2][2] = 0.0f;
+    lines[3][2] = 0.0f;
+  }
+
   result = isect_line_line_v3(UNPACK4(lines), i1, i2);
   /* The return-code isn't exposed,
    * this way we can check know how close the lines are. */



More information about the Bf-blender-cvs mailing list