[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 4 commits - oox/source sc/source svx/source

Fridrich Å trba fridrich.strba at bluewin.ch
Mon Jun 3 06:17:07 PDT 2013


 oox/source/vml/vmlshape.cxx                       |    3 +
 sc/source/core/tool/rangeutl.cxx                  |    4 +-
 svx/source/customshapes/EnhancedCustomShape2d.cxx |   37 ++++++++++++++--------
 3 files changed, 29 insertions(+), 15 deletions(-)

New commits:
commit 2327f65ccf8231cef7e6ed4a9fb0df8dbdaa15f2
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jun 3 10:16:26 2013 +0200

    Fixing crash with dereferencing front() and back() of an empty vector
    
    Change-Id: If7204614aa7a650f4a2804fc63dd3301ece2281e
    (cherry picked from commit f5d6e7af69f6b8972bd97d1d8e2a6d9ec5a6294a)

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 1ec5c24..35ad93d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -769,7 +769,8 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
         for ( unsigned int i = 0; i < aFlagLists.size(); i++ )
             aBezierCoords.Flags[i] = ContainerHelper::vectorToSequence( aFlagLists[i] );
 
-        if( aCoordLists.front().front().X == aCoordLists.back().back().X
+        if( !aCoordLists.front().empty() && !aCoordLists.back().empty()
+            && aCoordLists.front().front().X == aCoordLists.back().back().X
             && aCoordLists.front().front().Y == aCoordLists.back().back().Y )
         { // HACK: If the shape is in fact closed, which can be found out only when the path is known,
           // force to closed bezier shape (otherwise e.g. fill won't work).
commit 864dc65f8fb02348eaf0d83f38591f913342191f
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jun 3 14:55:52 2013 +0200

    And this one has the same potential to crash
    
    Change-Id: Icd2b2f2c11b7e86a10cae887b96f96a6fbe8a44e
    (cherry picked from commit cacc516693b879c08bd3b1963eeed9c38928615f)

diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 1fbf007..38305f6 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -394,7 +394,7 @@ sal_Int32 ScRangeStringConverter::IndexOfDifferent(
     sal_Int32       nIndex      = nOffset;
     sal_Bool        bExitLoop   = false;
 
-    while( !bExitLoop && (nIndex < nLength) )
+    while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
     {
         bExitLoop = (rString[ nIndex ] != cSearchChar);
         if( !bExitLoop )
commit 48cbf49e3c03e64192046211ca42e277bf89eab8
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Jun 3 14:51:24 2013 +0200

    Fix ooo51302-1.ods: check for special index value of -1
    
    Change-Id: I3fbb700300d18a878cbf23c94e35bc69f864824b
    (cherry picked from commit 50bbd1aefe0c78c254a18cc6e1dfeaf5c6858112)

diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 054c61f..1fbf007 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -374,7 +374,7 @@ sal_Int32 ScRangeStringConverter::IndexOf(
     sal_Bool        bQuoted     = false;
     sal_Bool        bExitLoop   = false;
 
-    while( !bExitLoop && (nIndex < nLength) )
+    while( !bExitLoop && (nIndex >= 0 && nIndex < nLength) )
     {
         sal_Unicode cCode = rString[ nIndex ];
         bExitLoop = (cCode == cSearchChar) && !bQuoted;
commit 6f2573dffc64bf36e284b6eae595a51c866cb49a
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Dec 10 14:45:55 2012 +0000

    #121437# Added patch from Regina which implements QuadraticBezier segemnts to CustomShapes
    
    Patch by: Regina
    Review by: ALG
    (cherry picked from commit 4faa46872cad4ed779b07803b7f616b32d800284)
    
    (cherry picked from commit a3b384ee41f352b5b99ea1265018f2d14405df65)

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 0675abd..f17e145 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -913,7 +913,7 @@ double EnhancedCustomShape2d::GetEquationValueAsDouble( const sal_Int32 nIndex )
                     struct EquationResult &aResult = ((EnhancedCustomShape2d*)this)->vEquationResults[ nIndex ];
 
                     fNumber = aResult.fValue = (*vNodesSharedPtr[ nIndex ])();
-                    aResult.bReady = sal_True;
+                    aResult.bReady = true;
 
                     if ( !rtl::math::isFinite( fNumber ) )
                         fNumber = 0.0;
@@ -1729,21 +1729,34 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
                 break;
 
                 case QUADRATICCURVETO :
+                {
                     for ( sal_Int32 i(0L); ( i < nPntCount ) && ( rSrcPt + 1 < nCoordSize ); i++ )
                     {
-                        const Point aControl(GetPoint( seqCoordinates[ rSrcPt++ ], true, true ));
-                        const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], true, true ));
+                        if ( rSrcPt )
+                        {
+                            const Point aPreviousEndPoint(GetPoint( seqCoordinates[ rSrcPt - 1 ], true, true));
+                            const Point aControlQ(GetPoint( seqCoordinates[ rSrcPt++ ], true, true ));
+                            const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], true, true ));
+                            const Point aControlA((aPreviousEndPoint + (aControlQ * 2.0)) / 3.0);
+                            const Point aControlB(((aControlQ * 2.0) + aEnd) / 3.0);
 
-                        DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
-                        basegfx::B2DPoint aStartPointB2D( aNewB2DPolygon.getB2DPoint(aNewB2DPolygon.count() - 1 ) );
-                        Point aStartPoint( aStartPointB2D.getX(), aStartPointB2D.getY() );
+                            DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)");
+                            aNewB2DPolygon.appendBezierSegment(
+                                basegfx::B2DPoint(aControlA.X(), aControlA.Y()),
+                                basegfx::B2DPoint(aControlB.X(), aControlB.Y()),
+                                basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+                        }
+                        else // no previous point , do a moveto
+                        {
+                            rSrcPt++; // skip control point
+                            const Point aEnd(GetPoint( seqCoordinates[ rSrcPt++ ], true, true ));
 
-                        aNewB2DPolygon.appendBezierSegment(
-                            basegfx::B2DPoint(aStartPoint.X() + 2.0*(aControl.X() - aStartPoint.X())/3.0, aStartPoint.Y() + 2.0*(aControl.Y() - aStartPoint.Y())/3.0),
-                            basegfx::B2DPoint(aEnd.X() + 2.0*(aControl.X() - aEnd.X())/3.0, aEnd.Y() + 2.0*(aControl.Y() - aEnd.Y())/3.0),
-                            basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+                            DBG_ASSERT(aNewB2DPolygon.count(), "EnhancedCustomShape2d::CreateSubPath: Error in adding Q control point (!)");
+                            aNewB2DPolygon.append(basegfx::B2DPoint(aEnd.X(), aEnd.Y()));
+                        }
                     }
-                    break;
+                }
+                break;
 
                 case LINETO :
                 {
@@ -2380,7 +2393,7 @@ bool EnhancedCustomShape2d::IsPostRotate() const
 
 SdrObject* EnhancedCustomShape2d::CreateLineGeometry()
 {
-    return CreateObject( sal_True );
+    return CreateObject( true );
 }
 
 


More information about the Libreoffice-commits mailing list