[Libreoffice-commits] libvisio.git: src/lib

David Tardon dtardon at redhat.com
Tue Apr 18 08:02:04 UTC 2017


 src/lib/VSDContentCollector.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 260183803863967f2923dd2787f076f1cead3f0e
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Apr 18 09:53:48 2017 +0200

    ofz#1150 avoid out-of-bounds access to controlPoints
    
    Change-Id: I82e1040d4dc3f0e688b49d949559a5a770127cf3

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 2716b64..2e5cc4a 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <algorithm>
 #include <cassert>
 #include <string.h> // for memcpy
 #include <set>
@@ -1960,8 +1961,10 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
   unsigned b = degree + 1;
   std::vector< std::pair<double, double> > points(degree + 1), nextPoints(degree + 1);
   unsigned i = 0;
-  for (; i <= degree; i++)
+  for (; i <= degree && i < controlPoints.size(); i++)
     points[i] = controlPoints[i];
+  if (degree >= controlPoints.size())
+    fill(points.begin() + controlPoints.size(), points.end(), controlPoints.back());
   while (b < knotVector.size() - 1)
   {
     i = b;


More information about the Libreoffice-commits mailing list