From fd0c84319e6847a97fcef389a241c455785997df Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 2 Aug 2022 14:09:44 +0200 Subject: [PATCH] WIP Tree Supports: Fixed one integer overflow. --- src/libslic3r/TreeSupport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index 689e57904..f14f6b343 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -592,7 +592,7 @@ static std::optional> polyline_sample_next_point_at_dis } std::rotate(part.begin(), part.begin() + optimal_start_index, part.end() - 1); part[part.size() - 1] = part[0]; // restore that property that this polyline ends where it started. - optimal_end_index = (optimal_end_index - optimal_start_index + part.size() - 1) % (part.size() - 1); + optimal_end_index = (part.size() + optimal_end_index - optimal_start_index - 1) % (part.size() - 1); } while (line.size() < min_points && current_distance >= scaled(0.1))