[Libreoffice-commits] .: Branch 'libreoffice-3-4' - filter/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Aug 9 03:01:54 PDT 2011


 filter/source/msfilter/msdffimp.cxx |   35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 9e812e5556d1e4b9656580f56c8a0aa0b8713f85
Author: Marc-Andre Laverdiere <marc-andre at atc.tcs.com / marcandre.laverdiere at tcs.com>
Date:   Tue Jul 19 09:41:27 2011 +0530

    Fix for valgrind error in msdffimp.cxx
    
    Error: Conditional jump or move depends on uninitialised value(s)
    Fix: Ensure that nGroupShapeFlags is initialized in the constructor
    Also cleaned up some duplicate variables
    (cherry picked from commit eb1d986b424a07a32dcc07e854e2b078150a3396)
    
    Conflicts:
    
    	filter/source/msfilter/msdffimp.cxx

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index d9df588..5b730e2 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4629,26 +4629,23 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
     rSt >> aRecHd;
     if ( aRecHd.nRecType == DFF_msofbtSpContainer )
     {
-        sal_Int32 nGroupRotateAngle = 0;
-        sal_Int32 nSpFlags = 0;
         mnFix16Angle = 0;
-        aRecHd.SeekToBegOfRecord( rSt );
+
+        if (!aRecHd.SeekToBegOfRecord(rSt))
+            return pRet;
+
         pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId );
         if ( pRet )
         {
-            nSpFlags = nGroupShapeFlags;
-            nGroupRotateAngle = mnFix16Angle;
-
             Rectangle aClientRect( rClientRect );
-
             Rectangle aGlobalChildRect;
             if ( !nCalledByGroup || rGlobalChildRect.IsEmpty() )
                 aGlobalChildRect = GetGlobalChildAnchor( rHd, rSt, aClientRect );
             else
                 aGlobalChildRect = rGlobalChildRect;
 
-            if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 )
-                || ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) )
+            if ( ( mnFix16Angle > 4500 && mnFix16Angle <= 13500 )
+                || ( mnFix16Angle > 22500 && mnFix16Angle <= 31500 ) )
             {
                 sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1;
                 sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1;
@@ -4694,18 +4691,18 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                 aRecHd2.SeekToEndOfRecord( rSt );
             }
 
-            if ( nGroupRotateAngle )
+            if ( mnFix16Angle )
             {
-                double a = nGroupRotateAngle * nPi180;
-                pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle, sin( a ), cos( a ) );
+                double a = mnFix16Angle * nPi180;
+                pRet->NbcRotate( aClientRect.Center(), mnFix16Angle, sin( a ), cos( a ) );
             }
-            if ( nSpFlags & SP_FFLIPV )		// Vertikal gespiegelt?
+            if ( nGroupShapeFlags & SP_FFLIPV )		// Vertical flip?
             {	// BoundRect in aBoundRect
                 Point aLeft( aClientRect.Left(), ( aClientRect.Top() + aClientRect.Bottom() ) >> 1 );
                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
                 pRet->NbcMirror( aLeft, aRight );
             }
-            if ( nSpFlags & SP_FFLIPH )		// Horizontal gespiegelt?
+            if ( nGroupShapeFlags & SP_FFLIPH )		// Horizontal flip?
             {	// BoundRect in aBoundRect
                 Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, aClientRect.Top() );
                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
@@ -6018,14 +6015,14 @@ SV_IMPL_OP_PTRARR_SORT(	SvxMSDffShapeTxBxSort,	SvxMSDffShapeOrder_Ptr	);
 SV_IMPL_OP_PTRARR_SORT(MSDffImportRecords, MSDffImportRec_Ptr)
 
 //---------------------------------------------------------------------------
-//  exportierte Klasse: oeffentliche Methoden
+//  exported class: Public Methods
 //---------------------------------------------------------------------------
 
 SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
                                  const String& rBaseURL,
                                  long      nOffsDgg_,
                                  SvStream* pStData_,
-                                 SdrModel* pSdrModel_,// s. unten: SetModel()
+                                 SdrModel* pSdrModel_,// see SetModel() below
                                  long      nApplicationScale,
                                  ColorData mnDefaultColor_,
                                  sal_uLong     nDefaultFontHeight_,
@@ -6038,8 +6035,10 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
      pShapeOrders( new SvxMSDffShapeOrders ),
      nDefaultFontHeight( nDefaultFontHeight_),
      nOffsDgg( nOffsDgg_ ),
-     nBLIPCount(  USHRT_MAX ),				// mit Error initialisieren, da wir erst pruefen,
-     nShapeCount( USHRT_MAX ),              // ob Kontroll-Stream korrekte Daten enthaellt
+     nBLIPCount(  USHRT_MAX ),				// initialize with error, since we fist check if the
+     nShapeCount( USHRT_MAX ),              // control stream has correct data
+     nGroupShapeFlags(0),                   //ensure initialization here, as some corrupted
+                                            //files may yield to this being unitialized
      maBaseURL( rBaseURL ),
      mpFidcls( NULL ),
      rStCtrl(  rStCtrl_  ),


More information about the Libreoffice-commits mailing list