summaryrefslogtreecommitdiff
path: root/tools/source/generic/poly.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tools/source/generic/poly.cxx')
-rw-r--r--tools/source/generic/poly.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 7f2772e47a95..4bf00644dba2 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1076,6 +1076,19 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const
}
*aPointIter++ = mpImplPolygon->mpPointAry[ i++ ];
+
+ if (aPoints.size() >= SAL_MAX_UINT16)
+ {
+ OSL_ENSURE(aPoints.size() < SAL_MAX_UINT16,
+ "Polygon::AdapativeSubdivision created polygon too many points;"
+ " using original polygon instead");
+
+ // The resulting polygon can not hold all the points
+ // that we have created so far. Stop the subdivision
+ // and return a copy of the unmodified polygon.
+ rResult = *this;
+ return;
+ }
}
// fill result polygon