[Libreoffice-commits] core.git: 2 commits - filter/source sc/source solenv/gbuild
Michael Stahl
mstahl at redhat.com
Wed Sep 20 11:13:03 UTC 2017
filter/source/msfilter/msdffimp.cxx | 21 ++++++++++++++++-----
filter/source/msfilter/svdfppt.cxx | 17 +++++++++++++----
sc/source/filter/excel/xiescher.cxx | 23 ++++++++++++-----------
sc/source/filter/inc/xiescher.hxx | 8 ++++----
solenv/gbuild/platform/com_MSC_class.mk | 6 ------
5 files changed, 45 insertions(+), 30 deletions(-)
New commits:
commit 0581342a5beffefe96ac3b10f46763cda93285a8
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Sep 20 12:44:47 2017 +0200
gbuild: remove obsolete comment
There is only one PCH since commit "kill gb_NoexPrecompiledHeader"
2bf530153e9fb24aef62bf5e16e23ea1412887dd
Change-Id: I1b31462227df021068e8a6320d0613809d2503bc
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 8fadf93bb50c..85701a3fbda1 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -63,12 +63,6 @@ endef
# PrecompiledHeader class
-# Note: MSVC has a race condition when dealing with .pdb files, that can result in error C1033 when
-# the .pdb file already exists and two cl.exe invocations try to modify it at the same time (which
-# is apparently most likely when generating both .pch files). The no-exceptions variant should be
-# rarely needed now, but in case this turns out to be a problem in practice, this will need to
-# be handled somehow (such as order-dependency of one on another).
-
gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
-FI$(1).hxx \
-Fp$(call gb_PrecompiledHeader_get_target,$(1)) \
commit adbf0374e92508ff7170cc1bde9ca63de112ca11
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Sep 20 12:36:41 2017 +0200
filter,sc: try to prevent potential SeekToEndOfRecord infinite loops
SeekToEndOfRecord() now doesn't seek to EOF if the offset is too large;
break out of loops in the obvious cases where this could be problematic.
But don't use SAL_WARN_UNUSED_RESULT because unfortunately GCC doesn't
allow to explicitly suppress that with a (void) cast.
Change-Id: Ie0211075bf0f4ef271bb26bdfead5fb070875a2b
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index ac04412ca3f4..48d2f2952121 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3210,7 +3210,11 @@ bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, sal_u
if (!ReadDffRecordHeader(rSt, aEscherObjListHd))
break;
if ( aEscherObjListHd.nRecVer != 0xf )
- aEscherObjListHd.SeekToEndOfRecord( rSt );
+ {
+ bool bSeekSuccess = aEscherObjListHd.SeekToEndOfRecord(rSt);
+ if (!bSeekSuccess)
+ break;
+ }
else if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer )
{
DffRecordHeader aShapeHd;
@@ -3225,7 +3229,9 @@ bool SvxMSDffManager::SeekToShape( SvStream& rSt, void* /* pClientData */, sal_u
break;
}
}
- aEscherObjListHd.SeekToEndOfRecord( rSt );
+ bool bSeekSuccess = aEscherObjListHd.SeekToEndOfRecord(rSt);
+ if (!bSeekSuccess)
+ break;
}
}
}
@@ -3596,7 +3602,9 @@ void SvxMSDffManager::ReadObjText( SvStream& rStream, SdrObject* pObj )
default:
break;
}
- aHd.SeekToEndOfRecord( rStream );
+ bool bSeekSuccess = aHd.SeekToEndOfRecord(rStream);
+ if (!bSeekSuccess)
+ break;
}
}
}
@@ -3782,9 +3790,12 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, SfxItemSet& rSet, cons
Still no luck, lets look at the end of this record for a FBSE pool,
this fallback is a specific case for how word does it sometimes
*/
- rObjData.rSpHd.SeekToEndOfRecord( rSt );
+ bool bOk = rObjData.rSpHd.SeekToEndOfRecord( rSt );
DffRecordHeader aHd;
- bool bOk = ReadDffRecordHeader(rSt, aHd);
+ if (bOk)
+ {
+ bOk = ReadDffRecordHeader(rSt, aHd);
+ }
if (bOk && DFF_msofbtBSE == aHd.nRecType)
{
const sal_uLong nSkipBLIPLen = 20;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index f39a726413e0..2bbadab82d74 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -559,7 +559,7 @@ bool SdrEscherImport::ReadString( OUString& rStr ) const
bRet = true;
sal_uLong nBytes = aStrHd.nRecLen;
rStr = MSDFFReadZString( rStCtrl, nBytes, bUniCode );
- aStrHd.SeekToEndOfRecord( rStCtrl );
+ bRet = aStrHd.SeekToEndOfRecord( rStCtrl );
}
else
aStrHd.SeekToBegOfRecord( rStCtrl );
@@ -2393,7 +2393,10 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream&
sal_Int32 nV = aSuf.toInt32();
if ( ( nV == nVersion ) && ( aPre == "___PPT" ) )
{
- rContentHd.SeekToEndOfRecord( rSt );
+ if (!rContentHd.SeekToEndOfRecord(rSt))
+ {
+ break;
+ }
ReadDffRecordHeader( rSt, rContentHd );
if ( rContentHd.nRecType == PPT_PST_BinaryTagData )
{
@@ -2857,7 +2860,10 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
DffRecordHeader aShapeHd;
if ( SeekToRec( rStCtrl, DFF_msofbtSpContainer, aEscherObjListHd.GetRecEndFilePos(), &aShapeHd ) )
{
- aShapeHd.SeekToEndOfRecord( rStCtrl );
+ if (!aShapeHd.SeekToEndOfRecord(rStCtrl))
+ {
+ break;
+ }
auto nListEndRecPos = SanitizeEndPos(rStCtrl, aEscherObjListHd.GetRecEndFilePos());
while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nListEndRecPos ) )
{
@@ -6875,7 +6881,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
if ( pHyperlink->nIndex == aInteractiveInfoAtom.nExHyperlinkId )
{
- aTextHd.SeekToEndOfRecord( rIn );
+ if (!aTextHd.SeekToEndOfRecord(rIn))
+ {
+ break;
+ }
ReadDffRecordHeader( rIn, aTextHd );
if ( aTextHd.nRecType != PPT_PST_TxInteractiveInfoAtom )
{
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index fd13897d33d1..3642f86e3e93 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3681,7 +3681,7 @@ OUString XclImpDffConverter::ReadHlinkProperty( SvStream& rDffStrm ) const
return aString;
}
-void XclImpDffConverter::ProcessDgContainer( SvStream& rDffStrm, const DffRecordHeader& rDgHeader )
+bool XclImpDffConverter::ProcessDgContainer( SvStream& rDffStrm, const DffRecordHeader& rDgHeader )
{
std::size_t nEndPos = rDgHeader.GetRecEndFilePos();
bool isBreak(false);
@@ -3692,26 +3692,27 @@ void XclImpDffConverter::ProcessDgContainer( SvStream& rDffStrm, const DffRecord
switch( aHeader.nRecType )
{
case DFF_msofbtSolverContainer:
- ProcessSolverContainer( rDffStrm, aHeader );
+ isBreak = !ProcessSolverContainer( rDffStrm, aHeader );
break;
case DFF_msofbtSpgrContainer:
- ProcessShGrContainer( rDffStrm, aHeader );
+ isBreak = !ProcessShGrContainer( rDffStrm, aHeader );
break;
default:
isBreak = !aHeader.SeekToEndOfRecord( rDffStrm );
}
}
// seek to end of drawing page container
- rDgHeader.SeekToEndOfRecord( rDffStrm );
+ isBreak = !rDgHeader.SeekToEndOfRecord( rDffStrm );
// #i12638# #i37900# connector rules
XclImpSolverContainer& rSolverCont = GetConvData().maSolverCont;
rSolverCont.UpdateConnectorRules();
SolveSolver( rSolverCont );
rSolverCont.RemoveConnectorRules();
+ return !isBreak;
}
-void XclImpDffConverter::ProcessShGrContainer( SvStream& rDffStrm, const DffRecordHeader& rShGrHeader )
+bool XclImpDffConverter::ProcessShGrContainer( SvStream& rDffStrm, const DffRecordHeader& rShGrHeader )
{
std::size_t nEndPos = rShGrHeader.GetRecEndFilePos();
bool isBreak(false);
@@ -3723,27 +3724,27 @@ void XclImpDffConverter::ProcessShGrContainer( SvStream& rDffStrm, const DffReco
{
case DFF_msofbtSpgrContainer:
case DFF_msofbtSpContainer:
- ProcessShContainer( rDffStrm, aHeader );
+ isBreak = !ProcessShContainer( rDffStrm, aHeader );
break;
default:
isBreak = !aHeader.SeekToEndOfRecord( rDffStrm );
}
}
// seek to end of shape group container
- rShGrHeader.SeekToEndOfRecord( rDffStrm );
+ return rShGrHeader.SeekToEndOfRecord( rDffStrm ) && !isBreak;
}
-void XclImpDffConverter::ProcessSolverContainer( SvStream& rDffStrm, const DffRecordHeader& rSolverHeader )
+bool XclImpDffConverter::ProcessSolverContainer( SvStream& rDffStrm, const DffRecordHeader& rSolverHeader )
{
// solver container wants to read the solver container header again
rSolverHeader.SeekToBegOfRecord( rDffStrm );
// read the entire solver container
ReadSvxMSDffSolverContainer( rDffStrm, GetConvData().maSolverCont );
// seek to end of solver container
- rSolverHeader.SeekToEndOfRecord( rDffStrm );
+ return rSolverHeader.SeekToEndOfRecord( rDffStrm );
}
-void XclImpDffConverter::ProcessShContainer( SvStream& rDffStrm, const DffRecordHeader& rShHeader )
+bool XclImpDffConverter::ProcessShContainer( SvStream& rDffStrm, const DffRecordHeader& rShHeader )
{
rShHeader.SeekToBegOfRecord( rDffStrm );
tools::Rectangle aDummy;
@@ -3757,7 +3758,7 @@ void XclImpDffConverter::ProcessShContainer( SvStream& rDffStrm, const DffRecord
SdrObjectPtr xSdrObj( ImportObj( rDffStrm, &pDrawObj, aDummy, aDummy ) );
if( pDrawObj && xSdrObj )
InsertSdrObject( GetConvData().mrSdrPage, *pDrawObj, xSdrObj.release() );
- rShHeader.SeekToEndOfRecord( rDffStrm );
+ return rShHeader.SeekToEndOfRecord( rDffStrm );
}
void XclImpDffConverter::InsertSdrObject( SdrObjList& rObjList, const XclImpDrawObjBase& rDrawObj, SdrObject* pSdrObj )
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index a4ac864c585d..6d0e7b1d56ef 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -1023,13 +1023,13 @@ private:
OUString ReadHlinkProperty( SvStream& rDffStrm ) const;
/** Processes a drawing container (all drawing data of a sheet). */
- void ProcessDgContainer( SvStream& rDffStrm, const DffRecordHeader& rDgHeader );
+ bool ProcessDgContainer( SvStream& rDffStrm, const DffRecordHeader& rDgHeader );
/** Processes the global shape group container (all shapes of a sheet). */
- void ProcessShGrContainer( SvStream& rDffStrm, const DffRecordHeader& rShGrHeader );
+ bool ProcessShGrContainer( SvStream& rDffStrm, const DffRecordHeader& rShGrHeader );
/** Processes the solver container (connectors of a sheet). */
- void ProcessSolverContainer( SvStream& rDffStrm, const DffRecordHeader& rSolverHeader );
+ bool ProcessSolverContainer( SvStream& rDffStrm, const DffRecordHeader& rSolverHeader );
/** Processes a shape or shape group container (one top-level shape). */
- void ProcessShContainer( SvStream& rDffStrm, const DffRecordHeader& rShHeader );
+ bool ProcessShContainer( SvStream& rDffStrm, const DffRecordHeader& rShHeader );
/** Inserts the passed SdrObject into the document. This function takes ownership of pSdrObj! */
void InsertSdrObject( SdrObjList& rObjList, const XclImpDrawObjBase& rDrawObj, SdrObject* pSdrObj );
More information about the Libreoffice-commits
mailing list