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

David Tardon dtardon at redhat.com
Thu Apr 13 10:28:24 UTC 2017


 src/lib/VSDContentCollector.cpp |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit a112df73521975f5cbdd8d98e55fb04b3c941a55
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Apr 13 12:27:10 2017 +0200

    ofz: avoid division by 0
    
    Change-Id: I2acea8d91e0fcae0b1d0d93a330730cdd1d449fc

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index f790080..ab37c41 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2134,6 +2134,8 @@ void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
   // Let knotVector run from 0 to 1
   double firstKnot = knotVector[0];
   double lastKnot = knotVector.back()-knotVector[0];
+  if (VSD_ALMOST_ZERO(lastKnot))
+    lastKnot = VSD_EPSILON;
   for (std::vector<double>::iterator knot = knotVector.begin(); knot != knotVector.end(); ++knot)
   {
     *knot -= firstKnot;
commit c04bd767cae4d4896e9069ba437167dfb29ddbfb
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Apr 13 12:23:58 2017 +0200

    ofz: nothing to be done for empty data
    
    Change-Id: If345b75ceffabe2c58e66b7b8fefdb5a1e376c3f

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 4a876c2..f790080 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -3735,16 +3735,18 @@ void libvisio::VSDContentCollector::collectMisc(unsigned level, const VSDMisc &m
 
 void libvisio::VSDContentCollector::collectLayerMem(unsigned level, const VSDName &layerMem)
 {
-  using namespace ::boost::spirit::classic;
-
   _handleLevelChange(level);
+  m_currentLayerMem.clear();
+
+  if (layerMem.m_data.empty())
+    return;
+
   librevenge::RVNGString text;
   std::vector<unsigned char> tmpData(layerMem.m_data.size());
   memcpy(&tmpData[0], layerMem.m_data.getDataBuffer(), layerMem.m_data.size());
   appendCharacters(text, tmpData, layerMem.m_format);
 
-  m_currentLayerMem.clear();
-
+  using namespace ::boost::spirit::classic;
   bool bRes = parse(text.cstr(),
                     //  Begin grammar
                     (


More information about the Libreoffice-commits mailing list