diff options
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r-- | filter/source/msfilter/countryid.cxx | 2 | ||||
-rw-r--r-- | filter/source/msfilter/dffpropset.cxx | 2 | ||||
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 15 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 145 | ||||
-rw-r--r-- | filter/source/msfilter/msocximex.cxx | 14 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 2 | ||||
-rw-r--r-- | filter/source/msfilter/svxmsbas.cxx | 2 |
7 files changed, 115 insertions, 67 deletions
diff --git a/filter/source/msfilter/countryid.cxx b/filter/source/msfilter/countryid.cxx index b6c5d25d89ce..a3795a94c574 100644 --- a/filter/source/msfilter/countryid.cxx +++ b/filter/source/msfilter/countryid.cxx @@ -325,7 +325,7 @@ CountryId ConvertLanguageToCountry( LanguageType eLanguage ) LanguageType ConvertCountryToLanguage( CountryId eCountry ) { - // just find the first occurance of eCountry and return the language type + // just find the first occurrence of eCountry and return the language type const CountryEntry* pEntry = std::find_if( pTable, pEnd, CountryEntryPred_Country( eCountry ) ); return (pEntry != pEnd) ? pEntry->meLanguage : LANGUAGE_DONTKNOW; } diff --git a/filter/source/msfilter/dffpropset.cxx b/filter/source/msfilter/dffpropset.cxx index e96283ec98d0..80c3c839a893 100644 --- a/filter/source/msfilter/dffpropset.cxx +++ b/filter/source/msfilter/dffpropset.cxx @@ -1132,7 +1132,7 @@ void DffPropSet::ReadPropSet( SvStream& rIn, bool bSetUninitializedOnly ) sal_uInt32 nMergeFlags = nContent; nMergeFlags &= ( nMergeFlags >> 16 ) | 0xffff0000; // clearing low word - nMergeFlags &= ( ( nCurrentFlags & 0xffff0000 ) // remove allready hard set + nMergeFlags &= ( ( nCurrentFlags & 0xffff0000 ) // remove already hard set | ( nCurrentFlags >> 16 ) ) ^ 0xffffffff; // attributes from mergeflags nCurrentFlags &= ( ( nMergeFlags & 0xffff0000 ) // apply zero master bits | ( nMergeFlags >> 16 ) ) ^ 0xffffffff; diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index bc3399e1ba96..1f6db0d8b530 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2598,7 +2598,7 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape, if ( pAny ) *pAny >>= sEquationSource; sal_Int32 nEquationSourceCount = sEquationSource.getLength(); - if ( nEquationSourceCount ) + if ( nEquationSourceCount && (nEquationSourceCount <= 128) ) { sal_Int32 i; for ( i = 0; i < nEquationSourceCount; i++ ) @@ -2644,7 +2644,18 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape, if ( aIter->nOperation & nMask ) { aIter->nOperation ^= nMask; - aIter->nPara[ i ] = rEquationOrder[ aIter->nPara[ i ] & 0x3ff ] | 0x400; + const sal_Int32 nIndex(aIter->nPara[ i ] & 0x3ff); + + // #124661# check index access, there are cases where this is out of bound leading + // to errors up to crashes when executed + if(nIndex < rEquationOrder.size()) + { + aIter->nPara[ i ] = rEquationOrder[ nIndex ] | 0x400; + } + else + { + OSL_ENSURE(false, "Attempted out of bound access to rEquationOrder of CustomShape (!)"); + } } nMask <<= 1; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index c9bb76029dd6..c65cfc057832 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -2012,20 +2012,23 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt if ( SeekToContent( DFF_Prop_pFormulas, rIn ) ) rIn >> nNumElem >> nNumElemMem >> nElemSize; - sal_Int16 nP1, nP2, nP3; - sal_uInt16 nFlags; - - uno::Sequence< rtl::OUString > aEquations( nNumElem ); - for ( i = 0; i < nNumElem; i++ ) + if ( nNumElem <= 128 ) { - rIn >> nFlags >> nP1 >> nP2 >> nP3; - aEquations[ i ] = EnhancedCustomShape2d::GetEquation( nFlags, nP1, nP2, nP3 ); + sal_Int16 nP1, nP2, nP3; + sal_uInt16 nFlags; + + uno::Sequence< rtl::OUString > aEquations( nNumElem ); + for ( i = 0; i < nNumElem; i++ ) + { + rIn >> nFlags >> nP1 >> nP2 >> nP3; + aEquations[ i ] = EnhancedCustomShape2d::GetEquation( nFlags, nP1, nP2, nP3 ); + } + // pushing the whole Equations element + const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) ); + aProp.Name = sEquations; + aProp.Value <<= aEquations; + aPropVec.push_back( aProp ); } - // pushing the whole Equations element - const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) ); - aProp.Name = sEquations; - aProp.Value <<= aEquations; - aPropVec.push_back( aProp ); } //////////////////////////////////////// @@ -2732,42 +2735,55 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj } if ( bHasShadow ) { - // #160376# sj: activating shadow only if fill and or linestyle is used - // this is required because of the latest drawing layer core changes. - // Issue i104085 is related to this. - sal_uInt32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash )); - if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( rObjData.eShapeType )) - nLineFlags &= ~0x08; - sal_uInt32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest )); - if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType )) - nFillFlags &= ~0x10; - if ( nFillFlags & 0x10 ) - { - MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); - switch( eMSO_FillType ) + static bool bCheckShadow(false); + + // #124477# Found no reason not to set shadow, esp. since it is applied to evtl. existing text + // and will lead to an error of in PPT someone used text and added the object shadow to the + // object carryintg that text. I found no cases where this leads to problems (the old bugtracker + // task #160376# from sj is unfortunately no longer available). Keeping the code for now + // to allow easy fallback when this shows problems in the future + if(bCheckShadow) + { + // #160376# sj: activating shadow only if fill and or linestyle is used + // this is required because of the latest drawing layer core changes. + // Issue i104085 is related to this. + sal_uInt32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash )); + if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( rObjData.eShapeType )) + nLineFlags &= ~0x08; + sal_uInt32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest )); + if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType )) + nFillFlags &= ~0x10; + if ( nFillFlags & 0x10 ) { - case mso_fillSolid : - case mso_fillPattern : - case mso_fillTexture : - case mso_fillPicture : - case mso_fillShade : - case mso_fillShadeCenter : - case mso_fillShadeShape : - case mso_fillShadeScale : - case mso_fillShadeTitle : - break; - // case mso_fillBackground : - default: - nFillFlags &=~0x10; // no fillstyle used - break; + MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid ); + switch( eMSO_FillType ) + { + case mso_fillSolid : + case mso_fillPattern : + case mso_fillTexture : + case mso_fillPicture : + case mso_fillShade : + case mso_fillShadeCenter : + case mso_fillShadeShape : + case mso_fillShadeScale : + case mso_fillShadeTitle : + break; + // case mso_fillBackground : + default: + nFillFlags &=~0x10; // no fillstyle used + break; + } } + if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) && ( rObjData.eShapeType != mso_sptPictureFrame )) // if there is no fillstyle and linestyle + bHasShadow = sal_False; // we are turning shadow off. } - if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) && ( rObjData.eShapeType != mso_sptPictureFrame )) // if there is no fillstyle and linestyle - bHasShadow = sal_False; // we are turning shadow off. - if ( bHasShadow ) - rSet.Put( SdrOnOffItem(SDRATTR_SHADOW, bHasShadow ) ); + if(bHasShadow) + { + rSet.Put(SdrOnOffItem(SDRATTR_SHADOW, bHasShadow)); + } } + ApplyLineAttributes( rSet, rObjData.eShapeType ); // #i28269# ApplyFillAttributes( rIn, rSet, rObjData ); if ( rObjData.eShapeType != mso_sptNil || IsProperty( DFF_Prop_pVertices ) ) @@ -3392,7 +3408,7 @@ bool SvxMSDffManager::SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMa } while ( rSt.GetError() == 0 && rSt.Tell() < nMaxFilePos && !bRet ); if ( !bRet ) - rSt.Seek( nFPosMerk ); // restore orginal FilePos + rSt.Seek( nFPosMerk ); // restore original FilePos return bRet; } @@ -3633,7 +3649,7 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte aColor = Color( (sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB ); } break; - case 0x04 : // substract grey level RGB(p,p,p) + case 0x04 : // subtract grey level RGB(p,p,p) { sal_Int16 nR = (sal_Int16)aColor.GetRed() - (sal_Int16)nParameter; sal_Int16 nG = (sal_Int16)aColor.GetGreen() - (sal_Int16)nParameter; @@ -3647,7 +3663,7 @@ Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nConte aColor = Color( (sal_uInt8)nR, (sal_uInt8)nG, (sal_uInt8)nB ); } break; - case 0x05 : // substract from grey level RGB(p,p,p) + case 0x05 : // subtract from grey level RGB(p,p,p) { sal_Int16 nR = (sal_Int16)nParameter - (sal_Int16)aColor.GetRed(); sal_Int16 nG = (sal_Int16)nParameter - (sal_Int16)aColor.GetGreen(); @@ -6160,25 +6176,46 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLe nLenFBSE = nLength; // ist FBSE gross genug fuer unsere Daten sal_Bool bOk = ( nSkipBLIPLen + 4 + nSkipBLIPPos + 4 <= nLenFBSE ); + bool bBLIPIsDirectlyEmbedded(false); - if( bOk ) + if(bOk) { - rSt.SeekRel( nSkipBLIPLen ); + rSt.SeekRel(nSkipBLIPLen); rSt >> nBLIPLen; - rSt.SeekRel( nSkipBLIPPos ); + + // #125187# do not simply skip these four bytes, but read them. This value + // is zero when the BLIP is embedded to the FBSE directly following in the + // stream, else 1. Use this as hint to be more reliable (see below) + rSt >> nBLIPPos; + + if(0 == nBLIPPos) + { + bBLIPIsDirectlyEmbedded = true; + } + rSt >> nBLIPPos; bOk = rSt.GetError() == 0; - nLength -= nSkipBLIPLen+ 4 + nSkipBLIPPos + 4; + nLength -= nSkipBLIPLen + 4 + nSkipBLIPPos + 4; } if( bOk ) { - // Besonderheit: - // Falls nBLIPLen kleiner ist als nLenFBSE UND nBLIPPos Null ist, - // nehmen wir an, dass das Bild IM FBSE drin steht! - if( (!nBLIPPos) && (nBLIPLen < nLenFBSE) ) + // #125187# the original check to test if the BLIP is following embeded in the FBSE was + // was (!nBLIPPos && nBLIPLen < nLenFBSE), but there are ppt documents + // where this is not sufficient (what means that for BLIPs in the picture + // stream the same conditions can be true sometimes). I experimented with various + // ppt files and detected that the four bytes before reading the nBLIPPos + // contain a flag which describes that embedding more reliable, thus I will + // use it here now in the form of the bBLIPIsDirectlyEmbedded variable (see above). + // This modification works with all ppt files I found which use directly embedded + // BLIPs and with the file which showed the error. More work may be needed when + // exceptions to this more strict schema may show up, though. + if(0 == nBLIPPos && nBLIPLen < nLenFBSE && bBLIPIsDirectlyEmbedded) + { + // get BLIP file position as directly following embedded nBLIPPos = rSt.Tell() + 4; + } // Das hat ja fein geklappt! // Wir merken uns, dass wir einen FBSE mehr im Pointer Array haben. diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx index f101c3cc4d16..9b2a72cc96e8 100644 --- a/filter/source/msfilter/msocximex.cxx +++ b/filter/source/msfilter/msocximex.cxx @@ -113,7 +113,7 @@ long ReadAlign(SvStorageStream *pS, long nPos, int nAmount) // referenced externally. On import from ms document try to save images for controls here. // Images are stored in directory called temp in the user installation directory. Next version of OO/SO // hopefully will address this issue and allow a choice e.g. images for controls to be stored as links -// or embeded in the document. +// or embedded in the document. // [out]location path to the stream to where the image is to be stored, // if same name exists in folder then this function calcuates a new name @@ -740,7 +740,7 @@ class ContainerRecReader { sal_uInt32 nUnknown_32b; // unknown 32 bit structure, flags ? sal_uInt16 nUnknown_16b; // unknown 16 bit structure - sal_uInt16 nMysteryLen; // lenght of unknown sub record + sal_uInt16 nMysteryLen; // length of unknown sub record *pS >> nUnknown_32b; *pS >> nUnknown_16b; @@ -4487,7 +4487,7 @@ OCX_Control * SvxMSConvertOCXControls::OCX_Factory( //Begin nasty hack /* There is a truly horrible thing with EditControls and FormattedField - Controls, they both pretend to have an EDITBOX ClassId for compability + Controls, they both pretend to have an EDITBOX ClassId for compatibility reasons, at some stage in the future hopefully there will be a proper FormulaField ClassId rather than this piggybacking two controls onto the same ClassId, when this happens uncomment the FORMULAFIELD in the OCX_Tab @@ -4566,8 +4566,8 @@ sal_Bool SvxMSConvertOCXControls::ReadOCXStream( SvStorageRef& rSrc1, pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); /*Get Class Id of this object, see if it is one of the types - *that this importer can handle, call the appropiate handler - to read that control, and call the appropiate handler to + *that this importer can handle, call the appropriate handler + to read that control, and call the appropriate handler to insert that control */ @@ -4603,8 +4603,8 @@ sal_Bool SvxMSConvertOCXControls::ReadOCXExcelKludgeStream( { sal_Bool bRet=sal_False; /*Get Class Id of this object, see if it is one of the types - *that this importer can handle, call the appropiate handler - to read that control, and call the appropiate handler to + *that this importer can handle, call the appropriate handler + to read that control, and call the appropriate handler to insert that control */ /*The Excel Kludge is to concatenate a class id with a contents diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 431262cc78bc..e9f657447c45 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -423,7 +423,7 @@ MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& return aRes; } -// Treat the args as possible inouts ( convertion at bottom of method ) +// Treat the args as possible inouts ( conversion at bottom of method ) sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet, const uno::Any& /*aCaller*/) { sal_Bool bRes = sal_False; diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx index 5c02f056b154..309faf40dac8 100644 --- a/filter/source/msfilter/svxmsbas.cxx +++ b/filter/source/msfilter/svxmsbas.cxx @@ -313,7 +313,7 @@ sal_Bool SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName, const String &sBasicModule = aVBA.GetStreamName( i); #endif /* #117718# expose information regarding type of Module - * Class, Form or plain 'ould VBA module with a REM statment + * Class, Form or plain 'ould VBA module with a REM statement * at the top of the module. Mapping of Module Name * to type is performed in VBA_Impl::Open() method, * ( msvbasic.cxx ) by examining the PROJECT stream. |