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

Uninitialized stack memory was used when intersecting 2D vectors.
This commit is contained in:
Campbell Barton 2022-10-06 17:32:11 +11:00 committed by Philipp Oeser
parent c184516c37
commit 283af78657
Notes: blender-bot 2023-02-14 00:29:15 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #101591, mathutils.geometry.intersect_line_line does not behave consistently for 2D vectors on Linux
1 changed files with 7 additions and 0 deletions

View File

@ -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. */