[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - tools/source vcl/source

Caolán McNamara caolanm at redhat.com
Wed Sep 10 08:37:44 PDT 2014


 tools/source/generic/poly2.cxx |    8 ++++----
 vcl/source/gdi/metaact.cxx     |    6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 6db17c300e59884e652125a0b3b11bdffdea38e2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 10 14:41:42 2014 +0100

    clip PolyPolygon::Insert on .svm load
    
    valgrind + bff
    
    (cherry picked from commit fd64d444b730f6cb7216dac8f6e3f94b97d7ab60)
    
    Conflicts:
    	tools/source/generic/poly2.cxx
    
    Change-Id: Ib3ed8a6e518c0686f8cbeaf021b9ca3a07005032
    Reviewed-on: https://gerrit.libreoffice.org/11382
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 4fa9a83..d3d4e09 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -167,7 +167,7 @@ void PolyPolygon::Insert( const Polygon& rPoly, sal_uInt16 nPos )
 void PolyPolygon::Remove( sal_uInt16 nPos )
 {
     DBG_CHKTHIS( PolyPolygon, NULL );
-    DBG_ASSERT( nPos < Count(), "PolyPolygon::Remove(): nPos >= nSize" );
+    assert(nPos < Count() && "PolyPolygon::Remove(): nPos >= nSize");
 
     if ( mpImplPolyPolygon->mnRefCount > 1 )
     {
@@ -185,7 +185,7 @@ void PolyPolygon::Remove( sal_uInt16 nPos )
 void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos )
 {
     DBG_CHKTHIS( PolyPolygon, NULL );
-    DBG_ASSERT( nPos < Count(), "PolyPolygon::Replace(): nPos >= nSize" );
+    assert(nPos < Count() && "PolyPolygon::Replace(): nPos >= nSize");
 
     if ( mpImplPolyPolygon->mnRefCount > 1 )
     {
@@ -200,7 +200,7 @@ void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos )
 const Polygon& PolyPolygon::GetObject( sal_uInt16 nPos ) const
 {
     DBG_CHKTHIS( PolyPolygon, NULL );
-    DBG_ASSERT( nPos < Count(), "PolyPolygon::GetObject(): nPos >= nSize" );
+    assert(nPos < Count() && "PolyPolygon::GetObject(): nPos >= nSize");
 
     return *(mpImplPolyPolygon->mpPolyAry[nPos]);
 }
@@ -531,7 +531,7 @@ Rectangle PolyPolygon::GetBoundRect() const
 Polygon& PolyPolygon::operator[]( sal_uInt16 nPos )
 {
     DBG_CHKTHIS( PolyPolygon, NULL );
-    DBG_ASSERT( nPos < Count(), "PolyPolygon::[](): nPos >= nSize" );
+    assert(nPos < Count() && "PolyPolygon::[](): nPos >= nSize");
 
     if ( mpImplPolyPolygon->mnRefCount > 1 )
     {
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 2bc51b4..744ec58 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1174,6 +1174,12 @@ void MetaPolyPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
             rIStm >> nIndex;
             Polygon aPoly;
             aPoly.Read( rIStm );
+            if (nIndex >= maPolyPoly.Count())
+            {
+                SAL_WARN("vcl.gdi", "svm contains polygon index " << nIndex
+                         << " outside possible range " << maPolyPoly.Count());
+                continue;
+            }
             maPolyPoly.Replace( aPoly, nIndex );
         }
     }


More information about the Libreoffice-commits mailing list