summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-10-04 19:55:04 +0200
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-10-06 13:16:56 -0400
commit9dd2c8ec4992516f0e6b3e4a98eda89ab8abc579 (patch)
tree03afbf0eac4dce6af22be9393c3e20b465c3faa9
parent1e7340538bfe4374df48e914e47ad5cddf1e309a (diff)
limit degree for b-spline to 15 to prevent std::bad_alloc, fdo#46100
Change-Id: Ib801c6af84b52ed093be2ba5eba902513bfa4070 Signed-off-by: Kohei Yoshida <kohei.yoshida@gmail.com>
-rw-r--r--chart2/source/view/charttypes/Splines.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index 5f29c41e365c..eac5b4a96911 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -35,6 +35,8 @@
#include <algorithm>
#include <functional>
+#define MAX_BSPLINE_DEGREE 15
+
//.............................................................................
namespace chart
{
@@ -702,7 +704,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);