From 0053de65567435422444ea7696a657d2e8fc9f21 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Feb 2024 16:38:39 +1100 Subject: [PATCH] Fix buffer overflow passing a vertical segment to convexhull_2d Convex hull calculation would "cap" line segments with the first point. Besides causing a buffer overflow when passing in two points, it's not needed as matching first/last ends aren't expected to be set by this function. --- source/blender/blenlib/intern/convexhull_2d.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/blender/blenlib/intern/convexhull_2d.c b/source/blender/blenlib/intern/convexhull_2d.c index e0b3278c6b0..18290597af2 100644 --- a/source/blender/blenlib/intern/convexhull_2d.c +++ b/source/blender/blenlib/intern/convexhull_2d.c @@ -69,7 +69,6 @@ static int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r /* a nontrivial segment */ r_points[++top] = minmax; } - r_points[++top] = minmin; /* add polygon endpoint */ BLI_assert(top + 1 <= n); return top + 1; }