editeng/source/rtf/svxrtf.cxx |6 +-
sw/source/core/doc/docnum.cxx |8
sw/source/filter/rtf/rtffld.cxx | 19 ++-
sw/source/filter/rtf/rtffly.cxx |8 +++-
sw/source/filter/rtf/rtftbl.cxx | 24 ++--
sw/source/filter/rtf/swparrtf.cxx |7 ---
sw/source/filter/rtf/swparrtf.hxx |1 -
7 files changed, 48 insertions(+), 25 deletions(-)
New commits:
commit 151ed37ea46e718ada412f37e7e540131effa0e5
Author: Michael Stahl m...@openoffice.org
Date: Thu Aug 2 15:54:46 2012 +0200
some tweaks in RTF filter
Signed-off-by: Petr Mladek pmla...@suse.cz
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 240fccd..0c0f156 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -29,6 +29,7 @@
#include ctype.h
#include tools/datetime.hxx
+#include tools/diagnose_ex.h
#include rtl/tencinfo.h
#include svl/itemiter.hxx
#include svl/whiter.hxx
@@ -801,12 +802,14 @@ void SvxRTFParser::ClearFontTbl()
{
for( sal_uInt32 nCnt = aFontTbl.Count(); nCnt; )
delete aFontTbl.GetObject( --nCnt );
+aFontTbl.Clear();
}
void SvxRTFParser::ClearStyleTbl()
{
for( sal_uInt32 nCnt = aStyleTbl.Count(); nCnt; )
delete aStyleTbl.GetObject( --nCnt );
+aStyleTbl.Clear();
}
void SvxRTFParser::ClearAttrStack()
@@ -1263,7 +1266,8 @@ bool SvxRTFParser::UncompressableStackEntry(const
SvxRTFItemStackType ) const
void SvxRTFItemStackType::Compress( const SvxRTFParser rParser )
{
-DBG_ASSERT( pChildList, There is no child list );
+ENSURE_OR_RETURN_VOID(pChildList, Compress: no ChildList );
+ENSURE_OR_RETURN_VOID(pChildList-Count(), Compress: ChildList empty);
sal_uInt16 n;
SvxRTFItemStackType* pTmp = (*pChildList)[0];
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index d5a609a..9970743 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -89,6 +89,9 @@ namespace {
}
}
+#include stdlib.h
+
+
inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel,
sal_uInt16 nMask )
{
if( 1 nLevel )
@@ -2169,6 +2172,11 @@ SwNumRule* SwDoc::FindNumRulePtr( const String rName )
const
void SwDoc::AddNumRule(SwNumRule * pRule)
{
+if ((SAL_MAX_UINT16 - 1) = pNumRuleTbl-Count())
+{
+OSL_ENSURE(false, SwDoc::AddNumRule: table full.);
+abort(); // this should never happen on real documents
+}
pNumRuleTbl-Insert(pRule, pNumRuleTbl-Count());
maNumRuleMap[pRule-GetName()] = pRule;
pRule-SetNumRuleMap(maNumRuleMap);
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 51741e1..c42a6a5 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -156,7 +156,10 @@ static RTF_FLD_TYPES _WhichFld( String rName, String
rNext )
{
rName = rName.Copy( nFndPos, static_cast xub_StrLen (nLen) );
nFndPos += nTokenStt + static_cast xub_StrLen (nLen);
-while( rNext.GetChar( nFndPos ) == ' ' )++nFndPos;
+while ((nFndPos rNext.Len()) (rNext.GetChar(nFndPos) == ' '))
+{
+++nFndPos;
+}
rNext.Erase( 0, nFndPos );
rNext = comphelper::string::stripEnd(rNext, ' ');
return aFldNmArr[n].eFldType;
@@ -388,8 +391,10 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
{
xub_StrLen nStartDel = nPos;
nPos += 2;
-while (aSaveStr.GetChar(nPos) == ' ')
+while ((nPos aSaveStr.Len()) (aSaveStr.GetChar(nPos) == ' '))
+{
++nPos;
+}
if (aSaveStr.EqualsIgnoreCaseAscii(MERGEFORMAT, nPos, 11))
{
xub_StrLen nNoDel = (nPos + 11 ) - nStartDel;
@@ -431,7 +436,9 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( \\* )) )
{
nPos += 2;
-while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+while ((nPos aSaveStr.Len())
+ (aSaveStr.GetChar(nPos) == ' '))
+{ nPos++; }
aSaveStr.Erase( 0, nPos );
// steht jetzt geanu auf dem Format-Namen
@@ -450,7 +457,9 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( \\* )) )
{
nPos += 2;
-while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+while ((nPos aSaveStr.Len())
+ (aSaveStr.GetChar(nPos) == ' '))
+{ nPos++; }
aSaveStr.Erase( 0, nPos );
// steht jetzt geanu auf dem Format-Namen
@@ -530,7 +539,7 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
// werden:
// \\data - Datenbank-Name als Field