[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 2 commits - chart2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 6 10:20:57 PDT 2012


 chart2/source/controller/dialogs/tp_ChartType.src |    4 ++--
 chart2/source/view/charttypes/Splines.cxx         |    6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit e935aab070404d318d5fa2eee4bfbd1184b8d080
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 4 20:16:56 2012 +0200

    limit polynomial degree in the dialog, related fdo#46100
    
    Change-Id: If49db1a503548103dcf605cc1c2d8064cdd2d5b2
    Signed-off-by: Kohei Yoshida <kohei.yoshida at gmail.com>

diff --git a/chart2/source/controller/dialogs/tp_ChartType.src b/chart2/source/controller/dialogs/tp_ChartType.src
index 049ef89..0f4966a 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.src
+++ b/chart2/source/controller/dialogs/tp_ChartType.src
@@ -257,11 +257,11 @@ ModalDialog DLG_SPLINE_PROPERTIES
         Repeat = TRUE ;
         Spin = TRUE ;
         Minimum = 1 ;
-        Maximum = 100 ;
+        Maximum = 15 ;
         StrictFormat = TRUE ;
         Unit = FUNIT_CUSTOM ;
         First = 1 ;
-        Last = 100 ;
+        Last = 15 ;
         SpinSize = 1 ;
     };
     FixedLine FL_SPLINE_DIALOGBUTTONS
commit 9dd2c8ec4992516f0e6b3e4a98eda89ab8abc579
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
    Signed-off-by: Kohei Yoshida <kohei.yoshida at gmail.com>

diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index 5f29c41..eac5b4a 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);


More information about the Libreoffice-commits mailing list