[Libreoffice-commits] .: chart2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 10:58:40 PDT 2012
chart2/source/view/charttypes/Splines.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit e1dee0aaacd8e30e2949053ebf351d76bad14ac3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Oct 4 19:55:04 2012 +0200
limit degree for b-spline to 15 to prevent std::bad_alloc, fdo#46100
Change-Id: Ib801c6af84b52ed093be2ba5eba902513bfa4070
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index 7129d44..8cb7fcb 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -24,6 +24,8 @@
#include <algorithm>
#include <functional>
+#define MAX_BSPLINE_DEGREE 15
+
//.............................................................................
namespace chart
{
@@ -691,7 +693,9 @@ void SplineCalculater::CalculateBSplines(
// ODF1.2 spec variable p
OSL_ASSERT( nResolution > 1 );
OSL_ASSERT( nDegree >= 1 );
- sal_uInt32 p = nDegree;
+
+ // limit the b-spline degree to prevent insanely large sets of points
+ sal_uInt32 p = std::min<sal_uInt32>(nDegree, MAX_BSPLINE_DEGREE);
rResult.SequenceX.realloc(0);
rResult.SequenceY.realloc(0);
More information about the Libreoffice-commits
mailing list