summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2017-10-30 14:29:18 +0100
committerDavid Tardon <dtardon@redhat.com>2017-10-30 14:36:49 +0100
commit6ba35e73d071dd396fc919e09daa09151354cb95 (patch)
tree98d50a0750307d1a23817aa82a8604b9148239ed
parent15f3774513d0181ad90da382297c175cc3424462 (diff)
ofz#3711 band-aid for OOB access in NURBS
Change-Id: Ied73be7f36bd070a38c13243dd851d0bcd4056a3
-rw-r--r--src/lib/VSDContentCollector.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index c842852..2ce80e9 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1983,7 +1983,11 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
double numer = knotVector[b] - knotVector[a];
unsigned j = degree;
std::vector<double> alphas(degree - 1, 0.0);
- for (; j >mult; j--)
+ // TODO: The second part of the end condition should not be
+ // necessary, but for some reason it can happen. I'm still
+ // convinced there is an inherent off-by-one bug in our impl. of
+ // the algorithm somewhere...
+ for (; j >mult && j < knotVector.size() - a; j--)
alphas[j-mult-1] = numer/(knotVector[a+j]-knotVector[a]);
unsigned r = degree - mult;
for (j=1; j<=r; j++)