From 3bd448d1a88a21ccbcc99ef5a9499338a712bad6 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 Feb 2024 14:28:00 +0000 Subject: [PATCH] Polygon: Avoid stackoverflow when summing exact numbers --- Polygon/include/CGAL/Polygon_2_algorithms.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Polygon/include/CGAL/Polygon_2_algorithms.h b/Polygon/include/CGAL/Polygon_2_algorithms.h index 5c836466c11..dc8f9c8708f 100644 --- a/Polygon/include/CGAL/Polygon_2_algorithms.h +++ b/Polygon/include/CGAL/Polygon_2_algorithms.h @@ -24,6 +24,7 @@ #include #include #include +#include #include /// @@ -153,6 +154,7 @@ area_2( ForwardIterator first, ForwardIterator last, ForwardIterator third = second; while (++third != last) { result = result + compute_area_2(*first, *second, *third); + exact(result); second = third; } } @@ -190,6 +192,7 @@ polygon_area_2( ForwardIterator first, ForwardIterator last, ForwardIterator third = second; while (++third != last) { result = result + compute_area_2(*first, *second, *third); + exact(result); second = third; } return result;