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

David Tardon dtardon at redhat.com
Fri Oct 20 11:44:30 UTC 2017


 src/lib/VSDContentCollector.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 04611b9f26cce0e7aa6c9901ae389243239ebc95
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Oct 20 13:23:58 2017 +0200

    ofz#2686 fix division by 0
    
    Change-Id: I853d263718a20f06e5bf5f8d834ca32be0a23023

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 7361668..04c58ec 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2145,6 +2145,13 @@ void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
 
   std::vector<double> knotVector(kntVec);
 
+  // Ensure knots are sorted in non-decreasing order
+  for (size_t i = 1; i < knotVector.size(); ++i)
+  {
+    if (knotVector[i] < knotVector[i - 1])
+      knotVector[i] = knotVector[i - 1];
+  }
+
   // Fill in end knots
   knotVector.reserve(controlPoints.size() + degree + 1);
   while (knotVector.size() < (controlPoints.size() + degree + 1))
commit 916a0cf635f351e22b44de27ba42e9654b4ee29f
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Oct 19 20:01:14 2017 +0200

    ofz#2521 fix OOB read from vector
    
    Change-Id: Ia6b08452dca71ae68bb0e9f2692ffdd75da9f537

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index bfbba28..7361668 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2024,6 +2024,9 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
     {
       for (i=degree-mult; i <= degree; i++)
       {
+        // FIXME: I've absolutely no idea how this can happen, but it can...
+        if (b-degree+i >= controlPoints.size())
+          break;
         points[i].first = controlPoints[b-degree+i].first;
         points[i].second = controlPoints[b-degree+i].second;
       }


More information about the Libreoffice-commits mailing list